Previous Topic: DialogNext Topic: Using GUIDE in SQL Mode


Creating a Simple Query Using DRAW

You can create a simple query automatically, without knowing the keywords, understanding the process, or completing any panels. All you need to know is the name of a table you want to access.

In DQL Mode

To create a query that lists all compound and simple fields

Type: DRAW table-name ALL

To create a query that does not list compound fields

Type: DRAW table-name

In SQL Mode Only

To create a query that selects all data

Type: DRAW table-name

To create a query that inserts data in all columns

Type: DRAW table-name INSERT

To create a query that deletes data from all columns

Type: DRAW table-name DELETE

To create a query that updates data in all columns

Type: DRAW table-name UPDATE

See the CA Dataquery Reference Guide for instructions on using the preceding SQL keywords. See the CA Dataquery Administrator for information about the INSERT, DELETE and UPDATE keywords.

Result

When you press Enter after entering the command, CA Dataquery displays a simple query.

Procedure

The following procedure shows how to create a simple query with a SQL Mode SELECT clause and a FROM clause. The procedure is the same in DQL Mode, producing a simple query with a FIND statement and a PRINT statement.

Step 1

Type DRAW table-name and press Enter.

Step 2

View the EDITOR panel containing the query. Following is an SQL Mode sample:

=> --------------------------------------------------------------------------DQD10 DATAQUERY: EDITOR ------------------------------------------------------------------------------- NAME: --------------- TYPE: QUERY STATUS: PRIVATE DESCRIPTION: ....+....1....+....2....+....3....+....4....+....5....+....6....+....7....+. .. ================================ T O P ===================================== 01 SELECT ORD-ID, CUST-ID, IND-CD, CUST-NO, ORD-DT, ORD-YR, 02 ORD-MO, ORD-DAY, EXP-DT, EXP-YR, EXP-MO, EXP-DAY, DISC-PCT, STAT, 03 SHIP-DT, SHIP-YR, SHIP-MO, SHIP-DAY, TERMS, INSTR, CUST-PO, 04 SHIP-ID, ORDER-TOTAL, FRT-AMT, REP-ID, ACT-DT, ACT-YR, ACT-MO, 05 ACT-DAY, ORD-AMT 06 FROM CAI-ORDERS-TBL; .. =========================== B O T T O M ================================== ------------------------------------------------------------------------------- <PF1> HELP <PF2> RETURN <PF3> EXECUTE <PF4> SAVE <PF5> DIALOG DEF <PF6> DELETE <PF7> BACKWARD <PF8> FORWARD <PF9> UPDATE <PF10> VALIDATE <PF11> RIGHT/LEFT <PF12> CREATE MODE

Note: If you enter DRAW from the EDITOR panel, the new query is appended to the existing (active) query. From any other panel, the new query becomes the active query.

Enter a name in the NAME field that begins with a letter and is one word long. Press <PF4> SAVE. See Step 7: Format Report and Execute Query.

To make changes to the query, see Accessing the EDITOR.