QMF offers three different query styles: OLAP, Prompted Query, and SQL:
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:
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:
|
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 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 | +--------------------------------------------+
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'