In this lesson, you will create a query to show the records for all the clerks in the Q.STAFF table. The Q.STAFF table is one of the sample tables that comes with QMF. Use the Prompted Query method; it is the easiest method to start with.
To select a table:
RESET QUERY (LANG=PROMPTEDThe Prompted Query panel displays the Tables panel:
PROMPTED QUERY LINE 1 +-------------------------------------+ Tables: | Tables | > ... | | | Type one or more table names. | *** END *** | 1 to 6 of 15 | | ( ) | | ( ) | | ( ) | | ( ) | | ( ) | | ( ) | +-------------------------------------+ | F1=Help F4=List F7=Backward | | F8=Forward F12=Cancel | +-------------------------------------+
Normally, you would type the name of the table you want to use, Q.STAFF on the Tables panel and press Enter. However, for this lesson you will choose the table from a list.
In addition, you will limit the list to only the tables that belong to user Q and that begin with the letter S. To do that, you use selection criteria. You will learn more about selection criteria in Displaying a list of database objects. In this case, you will use the characters q.s followed by a % sign.
The Table List panel displays with the names of all the tables that are owned by user Q and begin with S.
PROMPTED QUERY LINE 1 +-------------------------------------+ Tables: | Tables | > ... +-----------------------------------------------+ | | Table List | | *** END *** | | | | Name Owner | | | 1 to 5 of 5 | | | SALES Q | | | SALG Q | | | SAMTALE Q | | | x STAFF Q | | | SUPPLIER Q | + +-----------------------------------------------+ | | F1=Help F5=Describe F7=Backward F8=Forward | | | F10=Comments F11=Sort F12=Cancel | + +-----------------------------------------------+ OK, LIST command executed successfully.
The Tables panel displays again with Q.STAFF on the first line.
Q.STAFF is displayed under the Tables heading on the left side of the Prompted Query panel. This is called the echo area. The echo area shows you each part of the query as you create it.
The Specify panel is also displayed. Now that you have selected a table, you will use the Specify panel to create the rest of the query.
PROMPTED QUERY MODIFIED LINE 1 +------------------------+ Tables: | Specify | Q.STAFF | | | Select an item. | Columns: | | ALL | 2 1. Tables... | | 2. Columns... | *** END *** | 3. Row Conditions... | | 4. Sort... | | 5. Duplicate Rows... | +------------------------+ | F1=Help F12=Cancel | +------------------------+