SQL CREATE VIEW
Creates a logical view based on one or more tables
CREATE [SQL] VIEW <view> [(<alias> [,...])] AS <sub-query>
The CREATE VIEW or CREATE SQL VIEW commands create a logical view based on one or more tables. A view is a logical table that allows you to access data from other tables. A view itself contains no data.
|view||The name of the view to be created.|
|alias||This is an optional identifier that names a column in the view. The number of columns that you name must match the number of columns in the sub-query|
|AS sub-query||This identifies columns and rows of the tables from which the view is created. The sub-query is a SELECT statement.|
When the view is created, the view definition is written into the sysodbc.ini file in the current directory. If no sysodbc.ini file currently exists, it will be created. The DROP VIEW command removes the view definition from this file. The view will be available until the DROP VIEW command is issued or the sysodbc.ini file is manually modified. The data extracted from the view is the data current at the time of the SELECT statement, not at the time of the view creation.
// Create a view based on price being over $10 CREATE VIEW OverTen AS; SELECT * FROM orders WHERE price > 10 // Create a view based on price being over $20 CREATE SQL VIEW OverTwenty AS; SELECT * FROM orders WHERE price > 20