Online Documentation for SQL Manager for DB2
Views
A View is a logical table based on one or more tables or views. A view contains no data itself. The tables upon which a view is based are called base tables.
Views are useful for allowing users to access a set of relations (tables) as if it were a single table, and limiting their access to just that. Views can also be used to restrict access to rows (a subset of a particular table).
To create a new view:
- select the Database | New Object... main menu item;
- select View in the Create New Object dialog;
- define view properties using the appropriate tabs of View Editor.
Hint: To create a new view, you can also right-click the Views node or any object within this node in the DB Explorer tree and select the New View item from the context menu.
Another way to create a view is to build a query in Visual Query Builder (click the Create view Navigation bar item after building).
To create a new view with the same properties as one of existing views has:
- select the Database | Duplicate Object... main menu item;
- follow the instructions of Duplicate Object Wizard.
Alternatively, you can right-click a view in the DB Explorer tree and select the Duplicate View <view_name>... context menu item.
Duplicate Object Wizard allows you to select the database to create a new view in, and to edit the result SQL statement for creating the view.
To edit an existing view:
- select the view for editing in the DB Explorer tree (type the first letters of the view name for quick search);
- right-click the object and select the Edit View <view_name> context menu item, or simply double-click the view;
- edit view definition and data using the appropriate tabs of View Editor.
To drop a view:
- select the view to drop in the DB Explorer tree;
- right-click the object and select the Drop View <view_name>... context menu item;
- confirm dropping in the dialog window.
Note: If more convenient, you can also use the following shortcuts:
Ctrl+N to create a new view;
Ctrl+O to edit the selected view;
Shift+Del to drop the object from the database.