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).

 

 

Creating Views

 

To create a new view:

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:

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.

 

 

Editing Views

 

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.

 

Dropping Views

 

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.