Introducing Views

A view is often referred to as a virtual table, which means that a view looks like a table and is referenced like a table. However, views do not contain data like tables do. The only storage required for a view is the storage to maintain the definition of the view. A view is defined by a query on one or more database tables. A view is nothing more than a predefined query. Views are created by using the CREATE VIEW statement. After the view has been created, you can use the following SQL commands to refer to that view:

  • SELECT

  • INSERT

  • UPDATE

  • DELETE

Note

We used Personal Oracle to generate today's examples. MySQL, as well as some other implementations, do not support views. Please see the documentation of your specific SQL implementation ...

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.