Database Reference
In-Depth Information
AS
select_statement
[WITH CHECK OPTION]
<
view_attribute
>
::
=
{ENCRYPTION|SCHEMABINDING|VIEW_METADATA}
he meanings of the parameters and options are the following:
◾
View_name
speciies the name of a view
◾
Column
deines a speciied name to be used by a column
◾
WITH CHECK OPTION ensures that the modiied data are visible in the modiied view
◾
Select_statement
is a block of SQL statements that queries data for a view
◾
ENCRYPTION encrypts columns in a system table
◾
SCHEMABINDING binds a view with a speciic database schema
◾
VIEW_METADATA returns metadata information about a view
When creating a view, the following restrictions may apply:
◾
he name of a view must be unique within the database.
◾
he query used to create a view cannot contain the keywords ORDER BY, COMPUTE,
and INTO.
◾
If a view contains columns that are derived from an arithmetic expression, a built-in func-
tion, a constant, or columns from diferent tables with the same column names, you must
explicitly assign the names to these columns.
To illustrate the use of the CREATE VIEW statement, let us consider an example that selects
detailed information about a class. Figure 8.1 displays the code and the content in the view.
You can use the ALTER VIEW statement to modify the deinition of a view. To delete a view,
use the DROP VIEW statement.
Figure 8.1
Create CLASS_VIEW.