Name
CREATE VIEW — Create a new view
Syntax
Common Usage
CREATE VIEWdatabase_name
.view_name
AS SELECT...;
Description
The CREATE
VIEW
statement establishes a new view within the
named database. A view acts as a prepackaged subquery statement,
and can be accessed and referenced as if it were a table. A view
does not actually instance the data, but is dynamically
generated each time it is accessed.
If the optional TEMP
or TEMPORARY
keyword is present, the view will be
created in the temp
database.
Specifying either TEMP
or
TEMPORARY
in addition
to an explicit database name will result in an error, unless the
database name is temp
.
Temporary views may access tables from other attached databases. All nontemporary views are limited to referencing data sources from within their own database.
Creating a view that already exists
will normally generate an error. If the optional IF NOT EXISTS
clause is
provided, this error is silently ignored. This leaves the
original definition in place.
See Also
Get Using SQLite 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.