mysql view

mysql view

A view is a virtual table, Which doesn’t physically exist.
View is based on SQL select statement ie. its created by a query joining one
or more tables. View are stored as virtual table in the database and is created dynamically when view is referenced .

View are created and named and then called using that name,
and also views can be dropped using the name.

Simple View syntax

mysql> CREATE TABLE t (qty INT, price INT);
mysql> INSERT INTO t VALUES(3, 50);
mysql> CREATE VIEW v AS SELECT qty, price, qty*price AS value FROM t;
mysql> SELECT * FROM v;

+——+——-+——-+
| qty | price | value |
+——+——-+——-+
| 3 | 50 | 150 |
+——+——-+——-+

Leave a Reply

You must be logged in to post a comment.


All material @ copyrighted by chrisranjana.com. If you want to link to this article you are welcome to do so. Unauthorized publication is strictly prohibited. This developer tutorial website contains articles by Php programmers , Software developers, Mysql programmers and asp c# programmers. This website also contains ajax tutorials and advanced mysql sql stored procedures and functions tutorials and sample codes.