Query Manager

advertisement
Query Manager
Query Manager
• QM is a collection of tools you can use to obtain information
from the AS/400 database
Used to
– select, arrange, and analyze information stored in one or more
database tables,
– to produce reports or new tables.
• You can create and run your own query definitions, or you
can run existing queries that you did not create.
• You can format the way that retrieved query information is
presented by creating a report form, and applying it when
you run a query,
• You can let Query Manager format the query information for
you, using a simple default report form.
Query Manager
• Query Manager queries are created using the AS/400 SQL language.
– If you have little or no experience using the DB2 UDB for AS/400
SQL language, you can still create and change queries using Query
Manager's prompted query creation mode.
– A series of displays prompt you to enter all of the information that
DB2 UDB for AS/400 needs to create a query
• Query Manager queries can obtain information from a single table or
from as many as 32 tables.
• You can select all the table columns, or only a few of the columns, and
organize them for the type of output chosen.
• You can have all table rows in the output, or you can select only a few to
be included, using row selection tests.
• You can also use report breaks and arithmetic summary functions to
include additional information in your report, and make it easier to read
The iSeries database
•
The iSeries database is a relational database that stores information
at the most basic level in table format. A database can be compared
to a filing cabinet:
1.
The cabinet can have any number of drawers (libraries or collections).
2.
Each drawer contains folders (tables).
3.
Each folder contains pieces of paper (rows).
4.
All pieces of paper in a given folder are identical "fill-in-the-blanks" forms.
• A query is a question asked of the database.
For example, you use a query to get information from
database tables to produce a report.
• All queries created in Query Manager are written in the
DB2/400 SQL language. Most of the queries you write or run
will be SQL SELECT statements to generate reports on
existing database information.
• Query Manager queries can contain all interactive SQL
statements except for the CONNECT, DISCONNECT,
RELEASE, and SET CONNECTION statements.
• The following example shows a simple query that extracts
information from the sample table shown on page
SELECT DEPT, NAME, JOB, SALARY, COMM
FROM MYCOMP.STAFF
WHERE DEPT = 20 OR DEPT = 38
ORDER BY DEPT, JOB
Prompted queries in Query Manager
• Users with little or no experience in using the SQL language can create
and change SELECT statement queries using Query Manager's
prompted query creation mode
• A series of displays are shown, with prompts that ask you to enter all of
the information that Query Manager needs to create the query. Answer
the prompts shown on these displays to create a prompted query.
Report forms in Query Manager
• While a query is a question asked of the database, a report form
specifies the format of the answer. The report itself is the result of
applying a report form to the data generated by running a query.
• If you run a query shown without specifying a report form, Query
Manager generates a default report form and produces a simple report.
This default report form is referred to as *SYSDFT, the system default
form.
• You can improve the presentation of the report by creating a report form
and applying it to the query data. The report form could specify a page
heading and footing, and column headings that are more descriptive
Starting DB2 UDB for AS/400 Query Manager
•
You need to have authority to use the STRQM command before you
can use Query Manager. Start Query Manager by typing STRQM on
any command line, or by selecting the Query Manager option from
one of the following menus:
1.
2.
3.
4.
Query Utilities menu
SQL Commands menu
Query Commands menu
Start Commands menu
Download