QMF Offers Different Query Styles

QMF offers three different query styles for users with different skill levels:

Prompted Query
An easy-to-use query method that prompts you for the necessary information while building a query. The illustration below shows a partial QMF prompted query.

Prompted Query is designed for the beginner and occasional QMF user who wants to build a query but does not know SQL. QMF guides you through the steps you need and checks to ensure that the statement you build is valid.

You can use the Show SQL function key from the Prompted Query panel to see the equivalent of your prompted query in SQL. Show SQL is an easy way to learn SQL. In addition, you can build a prompted query and convert it to SQL with the QMF CONVERT command. After you convert a prompted query to SQL, you can choose to add additional SQL capabilities.

 PROMPTED QUERY                                       MODIFIED  LINE    1
                                +--------------------------------------------+
   Tables:                      |               Row Conditions               |
     Q.STAFF                    |                                            |
                                | Begin a condition by selecting one column, |
   Columns:                     | or by entering an expression or function.  |
     NAME                       |                                1 to 8 of 8 |
     DEPT                       |   *  Q.STAFF                               |
     JOB                        |   2.   ID                                  |
     SALARY                     |   3.   NAME                                |
     COMM                       |   4.   DEPT                                |
                                |   5.   JOB                                 |
   Row Conditions:              |   6.   YEARS                               |
   > If...                      |   7.   SALARY                              |
                                |   8.   COMM                                |
   *** END ***                  |                                            |
                                |   Expression (A+B, and so forth)...        |
                                +--------------------------------------------+
                                | F1=Help  F5=Describe  F7=Backward          |
                                | F8=Forward  F12=Cancel                     |
                                +--------------------------------------------+
Structured Query Language (SQL)
A language that describes your requests for data in the database.

SQL statements consist of verbs and clauses that describe aspects of the data request in more detail. If you are already familiar with SQL, QMF makes it easy for you to issue SQL statements to the database by using the SQL Query panel. You can issue any dynamic SQL statement from the query panel. The DRAW command displays model or prototype SELECT, INSERT, or UPDATE queries. You can build on these queries if you do not know the exact syntax of an SQL statement.

The illustrations below show a simple query and a complex query.

Simple SQL Query

SQL Query                                 MODIFIED  LINE    1
 
 SELECT NAME, YEARS, SALARY
   FROM Q.STAFF
   ORDER BY NAME
 

Complex SQL Query

SQL Query                                 MODIFIED  LINE    1
 
 (SELECT ID, NAME, SALARY
    FROM Q.STAFF
    WHERE SALARY>12000
UNION ALL
SELECT ID, NAME, SALARY
    FROM Q.STAFF
    WHERE DEPT=38)
UNION
SELECT ID, NAME, SALARY
    FROM Q.STAFF
    WHERE JOB='SALES'
Query-By-Example (QBE)
A graphical method to query, update, delete, or insert data. The illustration below represents Query-By-Example.

QBE minimizes your keystrokes and saves you time when entering a query. Begin your query by using the DRAW command. QMF presents the table and its column names for you. Then, enter a single letter beneath each column to indicate the action you want to perform on that column.

Q.STAFF | ID | NAME | DEPT | JOB | YEARS | SALARY | COMM |
--------+----+------+------+-----+-------+--------+------|
        | P. | P.   |      |     | P. _Y | P. _S  |      |
 
|        CONDITIONS           |
|-----------------------------|
| _Y = 10 AND _S > 20000      |


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