What is the SQL CREATE VIEW Statement?
A SQL view is a virtual table and the SQL CRERATE VIEW statement is the SQL command that adds a new view to a SQL database.
A view can be accessed using the SQL SELECT statement like a table. A view is built by selecting data from one or more tables.
Some views can also support the SQL INSERT, SQL UPDATE and SQL DELETE statements. In that case, the view must refer to a single table and include all NOT NULL columns of that table.
Why Use the SQL CREATE VIEW Statement?
SQL views are used because they can provide the following benefits / functions:
How To Use the SQL CREATE VIEW Statement
The SQL CREATE VIEW command is used as follows.
SQL CREATE VIEW Statement Syntax
The number of characters that can make up SQL names for tables, columns and views varies by DBMS. In many cases the limit is 30 characters. The leading character of the name must be alphabetic - not a number or special character. The name of a new view can not duplicate the name of an existing view or table and should not be the same as a SQL reserved word. The underscore character can be used to improve readability. List elements are seperated by commas.
SQL CREATE VIEW Statement Example - Data Filtering
The following example creates a view named V_TOP_CUSTOMER on table CUSTOMER with the following columns:
Here are the contents of the table:
This SQL CREATE VIEW Statement is executed:
|HOME | SQL OVERVIEW | SQL BASICS | SQL ADMINISTRATION | SQL ADVANCED | SQL SYNTAX|
|Copyright© 1999-2012, First Place Software, Inc.|