picoSQL - Language reference manual


CREATE VIEW


Syntax:

CREATE VIEW view-name [(column-name [,column-name] ... )]
AS simple-query [ WITH CHECK OPTION ]


Purpose:

Allows the creation of a logical view.


See also:

DROP, SELECT


Description:

This statement creates a new logical view on the database. A logical view is useful to give a different perspective on the data even though it is not stored in that way. Practically, a logical view is a query, made using a SELECT statement, that is stored and can be used as a real table. However the view do not exists phisically, so it is newly computed for any query. The SELECT statement cannot have aggregate functions nor ORDER BY or GROUP BY clauses.

A logical view can inherit the columns name from the names of the original columns or you can specify new names during the creation; in the latter case the number of specified names must correspond to the number of column returned by the query.

Creating a view that join two or more tables, picoSQL requires the join condition expressed with the appropriate join-clause (see the SELECT statement).

A view without joins can be update like any other table. If the clause WITH CHECK OPTION is specified, any update or insert to the view is rejected if do not meet the criteria of the view defined by its SELECT statement.


Index Previous Next