Using QMF


Format of SQL queries

Many simple SQL queries use the following basic SQL statement:

SELECT columnname
 FROM tablename
 WHERE condition
 ORDER BY columnname

Figure 59 shows a basic SQL query. This query displays the employee names, years of service, and salaries from the Q.STAFF table.

Figure 59. A basic SQL query

+--------------------------------------------------------------------------------+
| SQL QUERY                               MODIFIED    LINE 1                     |
|                                                                                |
| SELECT NAME, YEARS, SALARY                                                     |
|   FROM Q.STAFF                                                                 |
|   ORDER BY NAME_                                                               |
|                                                                                |
|                                                                                |
|                                                                                |
|                                                                                |
|                                                                                |
|                                                                                |
|                                                                                |
|                                                                                |
|                                                                                |
|                                                                                |
| *** END ***                                                                    |
|                                                                                |
|                                                                                |
| 1=Help       2=Run        3=End      4=Print     5=Chart        6=Draw         |
| 7=Backward   8=Forward    9=Form     10=Insert   11=Delete       12=Report     |
| OK, cursor positioned.                                                         |
| COMMAND ===>                                   SCROLL ===> PAGE                |
+--------------------------------------------------------------------------------+


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]