A VIEW is a named, stored SELECT query that behaves like a read-only table. When referenced in other queries, the database engine substitutes the view definition and executes the underlying SELECT in real time, returning the current data from the base tables. Views simplify complex joins, encapsulate business logic, enforce security by exposing only specific columns or rows, and promote code reuse. Unless the dialect supports and you explicitly create a materialized view, a standard view stores only its definition, not the data itself. Some systems allow updates through a view if the statement can be unambiguously mapped back to the base tables; otherwise the operation is rejected. Options such as OR REPLACE, TEMPORARY, WITH CHECK OPTION, and RECURSIVE vary by dialect and control replacement behavior, session scope, update constraints, or hierarchical queries. Dropping a view removes only the definition, leaving base tables intact.
view_name
(identifier) - Name of the view to create.column_list
(optional list) - Explicit column names if you want to rename or reorder columns.SELECT_statement
(query) - Any valid SELECT that returns rows and columns.OR REPLACE
(keyword) - Overwrites an existing view with the same name.TEMP
(TEMPORARY) - keyword|||Limits the view’s lifetime to the current session.WITH CHECK OPTION
(keyword) - Prevents INSERT or UPDATE statements that would make rows invisible to the view.CREATE TABLE, MATERIALIZED VIEW, ALTER VIEW, DROP VIEW, WITH CHECK OPTION, GRANT
SQL-92 Standard
A view is a saved SELECT statement that behaves like a virtual table. Querying it runs the underlying SELECT and returns up-to-date data.
A view itself does not cache data, so performance is similar to running the raw SELECT. Only materialized views store results for faster reads.
You can update, insert, or delete through a simple view that references one table and no aggregates. Complex views are read-only.
Dropping a view removes its definition. Base tables remain unchanged, but any dependent queries or applications that reference the view will fail until updated.