Creating a New Query in the Query List

You create a new query in the Query list as follows:

  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


Created October 7, 2009. Send feedback on this help topic to Sybase Technical Publications: pubs@sybase.com