• Image 1
  • Image 2
  • Image 3
  • Image 4
  • Image 5
  • Image 6
  • Image 7




Sunday, September 30, 2012

VIEW IN MYSQL


Mysql is is a desktop-based programming languages​​, and can also be web-based, because the programming language we often make the MySQL database, which often coexists with PHP. And PHP is a Web-based programming base.


Still the subject of MySQL, but with a different material. Previously I have discussed about the "trigger in mysql" .. Are you already understand the way users or know the function .. If you have not read it, please look at my blog, with the keyword "trigger in mysql".


And for the matter this time I will explain tentan "Views in MySQL" .. whether previously adan have understood the subject this time? or you've never read it, so you do not know this. Therefore let's read this article, and is secured by reading this article your knowledge about views in MySQL will increase ..


1. Views

Views in MySQL is a virtual form of a table view. And Views on the mysql query has been around since the release of MySQL version 5.0. Commands have similar views with the command "select". Since both of these commands are used to display the contents of data (records) from a table contained in a database.


2. Creating Views

Command views are actually used to display multiple columns (fields) of a table atanpa should perform filtering first.


And here's how to create views :

CREATE
[ OR REPLACE ]
[ ALGORITHM = {UNDEFINED | MERGE | TEMPTABLE} ]
[ DEFINER = {user | CURRENT_USER} ]
[ SQL SECURITY {DEFINER | INVOKER} ]
VIEW view_of_name [ (list_of_column) ]
AS select_your_statement
[ WITH [ CASCADED | LOCAL ] CHECK OPTION ]


This is an example if you want to display the name of the hardware and the hardware price of the hardware table :


CREATE VIEW ‘little_part_of_hardware’
AS (select hardware_name, hardware_price
FROM hardware )


3. Deleting View

Removal of view also be useful, which is to reduce the capacity of our database, then the delete command view is created, and this is the command :

DROP VIEW little_part_of_hardware;


Ok.. just it…
I hope you understand..
See you later

No comments:

Post a Comment