Progress
SQL-92
Guide and Reference


CREATE VIEW Statement

Creates a view with the specified name on existing tables or views.

SYNTAX

CREATE VIEW [ owner_name.]view_name 
  [ ( column_name, column_name,... ) ] 
  AS [ ( ] query_expression [ ) ] 
  [ WITH CHECK OPTION ] ; 

owner_name

Owner of the created view

( column_name, column_name,... )

Specifies column names for the view. These names provide an alias for the columns selected by the query specification. If the column names are not specified, then the view is created with the same column names as the tables or views on which it is based.

WITH CHECK OPTION

Checks that the updated or inserted row satisfies the view definition. The row must be selectable using the view. The WITH CHECK OPTION clause is only allowed on an updatable view.

NOTES

EXAMPLE

CREATE VIEW ne_customers AS 
          SELECT cust_no, name, street, city, state, zip 
          FROM customer 
          WHERE state IN ( 'NH', 'MA', 'ME', 'RI', 'CT', 'VT' ) 
          WITH CHECK OPTION ;     
CREATE VIEW order_count (cust_number, norders) AS 
          SELECT cust_no, COUNT(*) 
          FROM orders  
          GROUP BY cust_no; 

AUTHORIZATION

Must have DBA privilege, RESOURCE privilege, or SELECT privilege

SQL COMPLIANCE

SQL-92, ODBC Core SQL grammar

ENVIRONMENT

Embedded SQL, interactive SQL, ODBC applications, JDBC applications

RELATED STATEMENTS

"Query Expressions" in "SQL-92 Language Elements", DROP VIEW Statement


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095