Data Definition Language, CREATE VIEW (Part 3 of 3)
Format:
CREATE VIEW view_table_name
[(view_column_name1,
view_column_name2, ...)]
AS SELECT column1, column2, ...
FROM table1, table2, ...;
or
CREATE VIEW view_table_name
AS SELECT column1 AS alias1,
column2 AS alias2, ...
FROM table1, table2, ...;
The view_column_names are optional with one or more comma separated names to be used as alternate names in the view. These names must be a valid identifiers according to the rules of each RDBMS system. The number of view_column_names must match the number of columns in the SELECT statement. If you name any of the columns this way, you must name all of the columns this way.
If the view_column_names option is not used, the column names are inherited from the SELECT statement or column names can also be assigned by the AS column alias.
> The SQL standard does not have an ALTER VIEW, but DB2, Oracle, and SQL Server have implemented a non-standard ALTER VIEW. Other systems must use DROP VIEW to delete the view and then recreate the new view with CREATE VIEW.
> MySQL 5 supports views, but earlier versions of MySQL do not support views.
> With single table views, you can INSERT, UPDATE, and DELETE data. For other views, see your documentation.
> PostgreSQL views can only come from tables (not other views) and the view data is read only (no update).