Skip Headers
Oracle® TimesTen In-Memory Database SQL Reference
Release 11.2.1

Part Number E13070-04
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

CREATE VIEW

The CREATE VIEW statement creates a view of the tables specified in the SelectQuery clause. A view is a logical table that is based on one or more detail tables. The view itself contains no data. It is sometimes called a nonmaterialized view to distinguish it from a materialized view, which does contain data that has already been calculated from detail tables.

Required privilege

The user executing the statement must have the CREATE VIEW privilege (if owner) or CREATE ANY VIEW (if not the owner) for another user's view.

The owner of the view must have the SELECT privilege on the detail tables.

SQL syntax

CREATE VIEW ViewName AS SelectQuery

Parameters

The CREATE VIEW statement has the parameters:

Parameter Description
ViewName Name assigned to the new view.
SelectQuery Selects column from the detail tables to be used in the view. Can also create indexes on the view.

Restrictions on the select query

There are several restrictions on the query that is used to define the view.

Restrictions on the select query

Examples

Create a nonmaterialized view from the employees table.

Command> CREATE VIEW v1 AS SELECT employee_id, email FROM employees;
Command> SELECT FIRST 5 * FROM v1;
< 100, SKING >
< 101, NKOCHHAR >
< 102, LDEHAAN >
< 103, AHUNOLD >
< 104, BERNST >
5 rows found.

Create a nonmaterialized view from an aggregate query on the table t1.

CREATE VIEW v1 (max1) AS SELECT MAX(x1) FROM t1;

See also


CREATE MATERIALIZED VIEW
CREATE TABLE
DROP [MATERIALIZED] VIEW