Views are a way to save frequently used or complex queries and then access them in a SELECT statement as if they were a table. A view is not physically materialized on disk as is a table. The query is instead ran as a subquery whenever the view is accessed. Creating Views The CREATE VIEW command defines a view of a query. For example: CREATE VIEW comedies AS SELECT * FROM films WHERE kind = 'comedy'; Note that currently views ignore ORDER BY or SORT operations stored in the view. Dropping Views The DROP VIEW command removes a view. For example: DROP VIEW topten; |