Difference between revisions of "SQL CREATE VIEW"
Helengeorge (Talk | contribs) (→Class) |
Helengeorge (Talk | contribs) |
||
Line 1: | Line 1: | ||
− | |||
− | |||
==Purpose== | ==Purpose== | ||
Creates a logical view based on one or more tables | Creates a logical view based on one or more tables | ||
Line 45: | Line 43: | ||
==Products== | ==Products== | ||
− | Recital | + | Recital Server, Recital |
[[Category:Documentation]] | [[Category:Documentation]] | ||
[[Category:SQL|CREATE VIEW]] | [[Category:SQL|CREATE VIEW]] | ||
[[Category:Commands]] | [[Category:Commands]] |
Revision as of 16:22, 25 November 2009
Purpose
Creates a logical view based on one or more tables
Syntax
CREATE [SQL] VIEW <view> [(<alias> [,...])] AS <sub-query>
See Also
Description
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.
Keywords | Description |
---|---|
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.
Example
// 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;
Products
Recital Server, Recital