View Queries

You can edit queries associated with a view from the SQL Query tab of the view property sheet.



Any number of queries may be associated with a view, and the totality of their SQL statements is shown in this tab, linked by any of the standard SQL constructs, such as Union, etc.

You can edit the code shown in the SQL Query tab:
  • Directly in the tab.

  • Click the Edit with SQL Editor tool to edit the code in the PowerDesigner SQL Editor (see Writing SQL Code in PowerDesigner).

  • Click the Edit with tool (CTRL+E) to open the code in your favorite editor.

Any edits you make in this tab will propagate to the property sheets of the associated individual queries, which are available from the Query list at the bottom of the tab. Use the tools to the right of this list to create a new query (with the appropriate linking construct), delete the selected query, or open the property sheet of the selected query.

The following SQL constructs are available (if supported by your DBMS) for linking queries:

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

The following tabs are available: