Creating a view:

1.       Select the View object from the tree. The owner name, view name, and time of creation of all views on the database is displayed on a table in the View page.

2.       Click Create. The Create View Wizard - Introduction window appears.

3.       Click Next. The Name the View window appears.

4.       Select the schema name from the Schema Name drop down list.

5.       Enter the name of the view in the View Name field.

6.       Select the Continue with Wizard radio button orselect the Edit SQL script directly radio button to jump directly to the last step of the wizard (see step 14).

7.       Click the Next button. The Select the table(s) to be referenced by the view dialog box appears.

8.       Select tables to use in the view by double-clicking the table names on the left. Alternatively, use the buttons in the middle to add or remove columns. Selected tables appear on the right.

9.       A table can be added to a view more than once. If this is done, an alias for the table must be provided. The alias is a new name for the table that allows for columns in the table to be referenced more than once. To add an alias:

a)       Select a table that has already been added to the view.

b)       Enter an alias name into the field under the Alias heading. The default name appears as TableAliasName#.

10.   Click Next. The Select the column(s) to be displayed in the view window appears.

11.   Select columns to include in the view by double-clicking the column names on the left. Alternatively, use the buttons in the middle to add or remove columns. Selected columns appear on the right. Columns added more than once must have an alias. Column aliases are created the same way as table aliases.

12.   Click Next. The WHERE clause window appears.

13.   Enter a condition by which the data in the view is to be filtered.

NOTE      WHERE statements must conform to SQL syntax rules. Please see the section on Constraint Syntax at the end of chapter 4 for more information.

14.   Click Next. The Final review window appears.

15.   If you wish to alter the view data after reviewing the SQL script, enter a new script into the Create View SQL script field or click the Previous button to display previous wizard screens.

16.   Click the Finish button after reviewing the SQL script.

17.   Click OK.


Related Topics:

Creating a View