10. Views, Temporary Tables, CTEs, and Indexes
A database is made up of more than just a schema and permanent base tables. It can contain views, temporary tables, and common table expressions (CTEs). It may also contain indexes, which although no longer part of the SQL standard, are supported by most DBMSs for enforcing primary key constraints and speeding retrieval performance.
Views
A view is a virtual table that is produced by executing a SQL-query. It is stored in the data dictionary as a named SELECT. Whenever a SQL query contains the name of a view, the DBMS executes the query associated with the view's definition to create its virtual result table. That table can the be used as a source table by the remainder of the query in which its name ...
Get SQL Clearly Explained, 2nd 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.