Create a view
mysql>
mysql>
mysql> CREATE TABLE titles (
-> titleID int(11),
-> title varchar(100),
-> subtitle varchar(100),
-> authors varchar(255)
-> );
Query OK, 0 rows affected (0.00 sec)
mysql>
mysql>
mysql>
mysql> INSERT INTO titles VALUES (1,'Linux','Installation, Konfiguration, Anwendung','Tom'),
-> (2,'The Definitive Guide to Excel VBA',NULL,'Tom, Kramer'),
-> (3,'Client Server Survival Guide',NULL,'Bob, Amy'),
-> (4,'Web Application Development with PHP 4.0',NULL,'Green'),
-> (7,'MySQL',null,'DuBois Paul'),
-> (9,'MySQL & mSQL',NULL,'King Tim, Reese Georg');
Query OK, 6 rows affected (0.00 sec)
Records: 6 Duplicates: 0 Warnings: 0
mysql>
mysql>
mysql>
mysql> CREATE or replace VIEW v1 AS
-> SELECT titleID, title, subtitle FROM titles
-> ORDER BY title, subtitle;
Query OK, 0 rows affected (0.00 sec)
mysql>
mysql> drop table titles;
Query OK, 0 rows affected (0.00 sec)
mysql>
Related examples in the same category