Creating a Database View

Create a database view to see a subset of rows or columns from one or more tables. Each time you select a database view and use the view data, Sybase WorkSpace executes a select statement to retrieve the data and creates the database view.

Prerequisites 

Before you can create a database view, be sure the data server for which you are creating a view is running, and you created and established a connection to the data server.

  1. Right-click the Views folder and select New > View.

    The Select Tables dialog displays.

  2. In the Select Tables dialog box, click the name of each table or view you want to open in the list displayed and then click the Open button to open them.

    Representations of the selected tables and views display in Visual SQL.

  3. In the Table Layout panel, select the columns to include in the view and include computed columns as needed.
  4. Join the tables if there is more than one table in the view.
  5. In the Where panel, specify criteria to limit rows retrieved (Where tab), create computed columns (Compute tab), sort columns (Sort tab), group retrieved rows (Group tab), limit the retrieved groups (Having tab), and format results as XML (XML tab), if appropriate.

    DDL for the view is displayed in the Preview panel.

  6. When you have completed the view, click the OK button.
  7. Name the view.

    Include view or some other identifier in the view's name so that you can distinguish it from a table in the Select Tables dialog box.

  8. Click the Create button.

    Sybase WorkSpace generates a create view statement and submits it to the DBMS. The view then opens in the View Editor.

Send your feedback on this help topic to Sybase Technical Publications: pubs@sybase.com

Your comments will be sent to the technical publications staff at Sybase, Inc. For product-related issues or technical support, contact Sybase Technical Support at 1-800-8SYBASE.