----------  Create or Drop View  ----------

The "create view" command uses a variation of the "select command" to create a
logical  table  or  view of one or more tables.  The view is not an additional
table stored in the database, but once defined, it may be treated as an  ordi-
nary table. There are three variations:

Syntax:

a) create view VIEW [(ATTR_NAME {, ATTR_NAME})] as
        select [    |all     |  | *             |]
                    |distinct|  |EXPR {, EXPR}  |
        from TABLE [ [alias] ALIASNAME ] {, TABLE [ [alias] ALIASNAME ]}
        [ WHERE_CLAUSE ]
        [ GROUP_BY_CLAUSE ]
        [ HAVING_CLAUSE ]
        [ SORT_CLAUSE ];

VIEW is any legal table or view name not preceded by the keyword "table".
ATTR_NAME is the attribute name defined in the view.

Syntax:

b) create view VIEW as
   select [     |all      | |  *                                           |]
                |distinct | |EXPR [print HEADER]  {, EXPR [print HEADER]}  |
        from TABLE [ [alias] ALIASNAME ] {, TABLE [ [alias] ALIASNAME ]}
        [ WHERE_CLAUSE ]
        [ GROUP_BY_CLAUSE ]
        [ HAVING_CLAUSE ]
        [ SORT_CLAUSE ];

HEADER is an attribute name defined in the view.

The SELECT part of a view definition may include functions  (max,  avg.  etc),
"group  by"  or  HAVING clauses.  Also, the WHERE clause in the SELECT may in-
clude expressions involving operators or subqueries.  The  keyword  "distinct"
may be used.

Syntax:

c) create view VIEW [(ATTR_NAME {, ATTR_NAME})] as 

          QUERY_EXPRESSION

          [ SORT_CLAUSE ];

The SORT_CLAUSE is:

    |sort | [|by|] |ATTR_NAME | [|ascending |] {, |ATTR_NAME | [|ascending |]}
    |order|  |on|  |ATTR_NUM  |  |asc       |     |ATTR_NUM  |  |asc       |
                   |COLUMN_NUM|  |descending|     |COLUMN_NUM|  |descending|
                                 |desc      |                   |desc      |

See also: QUERY_EXPRESSION (By entering help select).

To remove a view, the "drop view" command is used.

Syntax:

     drop view VIEW;
