DB2 graphic  QMF Version 8

QMF offers different query styles

QMF offers three different query styles: OLAP, Prompted Query, and SQL:

OLAP query
OLAP queries are multidimensional queries that slice, dice, and rotate information. These queries augment or replace more complicated, relational queries. In DB2 QMF for Windows, there is an OLAP Query Wizard that can help you build OLAP queries.

At the QMF for Windows main window, select File, New, OLAP query to open the QLAP Query Wizard. Use the wizard to:

When the wizard closes, the OLAP window layout opens:

Table 2. OLAP window layout
Object explorer Layout designer Query results grid
The object explorer pane, on the left, lists the columns, dimensions, and measures defined for the cube. The layout designer dialog box is a palette onto which you can:
  • Drag columns from the object explorer
  • Select a column for the top group (ACROSS row)
  • Select a column for the side group (GROUP or AGGREGATION rows)
  • Modify the layout of the OLAP query interactively by dragging columns to and from the object explorer to the layout designer.
These columns contain no data.

The OLAP query results grid is uploaded interactively from changes made with the layout designer.

The OLAP query results grid contains the data columns selected for the OLAP query in the order determined by the layout designer.



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'


Go to the previous page Go to the next page

Downloads | Library | Support | Support Policy | Terms of use | Feedback
Copyright IBM Corporation 1982,2004 Copyright IBM Corporation 1982, 2004
timestamp Last updated: March, 2004