Chapter 3 Building Physical Diagrams


Editing query code in the SQL Query tab

You can edit the code shown in the SQL Query tab in any of the following ways:

Any edits you make in the SQL Query tab will propagate to the property sheets of the associated individual queries (see Opening the property sheet of a query).

Query list

The individual queries associated with the view are available from the Query list at the bottom of the SQL Query tab. You can create and delete queries using the tools at the bottom of the tab.

Steps To create a new query in the Query list:

  1. Click the Add a query tool to the right of the Query list (you can specify the way in which the new query will be linked with the other queries by clicking the arrow to the right of the tool and selecting one of the constructs listed below).

    The new query's property sheet opens.
  2. Enter the query code and click OK.

    The new query is added to the Query list in the View property sheet SQL Query tab, and its code is added to the tab.

The following SQL constructs are available for linking queries in PowerDesigner (depending on your DBMS):

Construct Result Example
Union [default] Displays all the data retrieved by both the queries, except where results are repeated. SELECT 1: ABC
SELECT 2: BCD
Result: ABCD
Union All Displays all the data retrieved by both the queries, including repeated results. SELECT 1: ABC
SELECT 2: BCD
Result: ABCBCD
Intersect Displays only the data retrieved by both the queries. SELECT 1: ABC
SELECT 2: BCD
Result: BC
Minus Displays only the data retrieved by one or other of the queries, but not by both. SELECT 1: ABC
SELECT 2: BCD
Result: AD

Steps To delete a query from the Query list:

  1. Select the query in the Query list.
  2. Click the Delete tool to the right of the Query list.

    The query is removed from the Query list and its code deleted from the tab.

 


Copyright (C) 2007. Sybase Inc. All rights reserved.