Saturday, August 20, 2011

Create VIEW on MySQL

Here is the example to create a VIEW on MySQL

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;


No comments: