Creating visual queries using the Draw Query wizard

Use the Draw Query wizard to create a query object automatically based on the query type and tables that you specify. This menu option is the same as the DRAW command in QMF for CICS/TSO.

About this task

The Draw Query wizard builds the SQL statements for the query.

To create a query using the Draw Query wizard:

Procedure

  1. Open the Create New Query Using the Draw Query wizard by clicking the Draw Query toolbar button.

    You can also open the Create New Query Using the Draw Query wizard by selecting File > New > Other > Query using Draw Query wizard.

  2. From the Data Source list select the data source where the tables that you want to use in the query are stored.
  3. Click one of the Query Type radio buttons to select the type of query that you want to create. You can select one of the following:
    • Select to create a SQL SELECT statement that will retrieve rows of data from one or more tables.
    • Update to create a SQL UPDATE statement that will allow you to change data that is contained in a table.
    • Insert to create a SQL INSERT statement that will add new rows to a table. You can only update one table at a time using this statement.
  4. In the Query Tables list specify the table or tables that will be included in the query.
    1. To specify a table, type the owner of a table in the Owner field, the name of the table in the Name field, and the correlation ID of the table in the Identifier field.
    2. Click Add.

    The table is listed in the Tables list.

  5. If you do not know the table name, you can search a list of tables that are available on the data source, by clicking Add from list.

    The Object List window opens. Using the Object List window you can select one or more tables to include in the query if you have chosen the Select option as the query type.

  6. To remove a table from the Tables list, select the table name and click the Remove Table icon. Use the Move Table Up in List or the Move table Down in List icons to move a table up and down in the Tables list.
  7. Click Finish to create the query.

    The Create New Query Using Draw Query Wizard closes. The SQL for the query is displayed in the query workstation window. You can edit the SQL in the available window.