Using Views
You can use views, or virtual tables, to encapsulate complex queries. After a view on a set of data has been created, you can treat that view as another table. However, special restrictions are placed on modifying the data within views. When data in a table changes, what you see when you query the view also changes. Remember that views do not take up physical space in the database as tables do.
The syntax for the CREATE VIEW statement is |
CREATE VIEW <view_name> [(column1, column2...)] AS SELECT <table_name column_names> FROM <table_name>
As usual, this syntax may not be clear at first glance, but today's material contains many examples ...
Get Sams Teach Yourself SQL in 21 Days, Fourth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.