Main Steps in Using Query Builder

From DBArtisan
Jump to: navigation, search

Go Up to Using Query Builder

To use Query Builder, do the following:

Note: You can start Query Builder directly from a table or view which automatically selects the instance or database which contains that table or view.
  1. On the Tools menu, click Query Builder.
Query Builder opens.

Selecting a Database

To create an SQL statement, first select an instance or database.

Note: You can start Query Builder directly from a table or view which automatically selects the database which contains that table or view.

If you are working with Microsoft SQL Server or Sybase ASE, Query Builder provides two drop-down lists. The first drop-down list displays all available databases for the target server. The second drop-down list displays owners.

If you are working with Oracle, IBM DB2 for z/OS and OS/390 or IBM DB2 for Linux, Unix, and Windows the first drop-down list is unavailable.

Note: You can start Query Builder directly from a table or view which automatically selects the database which contains that table or view.
  1. Start Query Builder.
  2. In the database drop-down list, click the target instance or database.
  3. In the owners drop-down list, select the appropriate owner.
    Query Builder is ready for Statement selection.
  4. To select different instances or databases while Query Builder is running, on the Tables/Views Tab, in the database drop-down list, click the target instance or database.
    The current query clears and a warning prompt is displayed.
  5. To save the current query, click Yes.
    The Save As dialog box opens.
  6. To continue without saving, click No.

Selecting a Statement

Query Builder lets you build SELECT, INSERT, UPDATE, DELETE, and CREATE VIEW queries simultaneously.

To select a statement, do the following:

  1. On the Query Builder tool bar, click the statement drop-down list, and then click the target statement type.
    OR
    In the SQL Diagram Pane, right-click, and then click the target statement type.

Selecting Tables and Views

To build a query, open one or more tables or views in the SQL Diagram Pane. For details, see SQL Diagram Pane.

You can use different tables or views for each type of query.

Tip: For multiple tables: Press SHIFT+click for adjacent tables or CTRL+click for nonadjacent tables. You can also drag the bounding line with your pointer to select multiple tables.

To select a Table or View, do the following:

  1. In the Tables/Views Tab, drag the target table or view to the Diagram Pane.
    OR
    In the Tables/Views Tab, click target table or view and then, on the Query Builder tool bar, click Add.
    OR
    In the Tables/Views Tab, right-click target table or view, and then click Add.
    Query Builder displays the target table(s) and view(s) in the SQL Diagram Pane.

Selecting Columns

You must select at least one column to build a query. Query Builder displays columns in each table in the SQL Diagram window. By default, Query Builder exposes every column in a table. You can select the columns you want to use for your query. Query Builder orders them, in your statement, in the select order.

Query Builder lets you select columns. For details, see:

You can select an individual column or all columns. Query Builder orders them, in your statement, in the select order. You can reorder columns after you set them in your diagram or statement.


Selecting Columns in the SQL Diagram Pane

To select a column in the SQL Diagram Pane, do the following:

  1. Select the check box to the left of the target column name.

Selecting Columns in the SQL Statement Tree

Query Builder lets you select and set individual properties using the Selected Column Properties Dialog Box. For details, see Column Properties.

Selecting all Columns

Query Builder uses columns in statements based on the order of selection. When you select all columns, Query Builder displays the columns in the order they appear in the table.

Note: Query Builder lets you select all columns in single or multiple tables.

To select all columns, do the following:

  1. On the Query Builder menu, click Select Star.

Topics