Creating a query
Use the Query window to create a query.
To create a query:
- Choose Components > Query from the HPL main window.
The Query window appears, as Figure 1 shows.
- Click Create in the Selection Type group.
- Choose a name for your query and type it in the Query text box.
- In the Database text box, type the
name of the database that contains the tables from which you want
to extract data. Or, click the down arrow to select from a database
selection list. The following figure shows the Query window with the Query text box completed and stores_demo selected from the selection list.Figure 1. The Query window
- Click OK.
The Query-Definition window appears, as Figure 2 shows. The name that you chose for your query appears in the title bar.
- Type your query in the Select, From,
and Where text boxes. The following figure shows the following simple query of the customer table of the stores_demo database:
SELECT customer.fname, customer.lname, customer.zipcode FROM customer WHERE zipcode > 50000
Figure 2. The Query-Definition windowIf you prefer, you can type the entire query into the Select text box. If you later edit the query, ipload divides the query into SELECT, FROM, and WHERE clauses.
- Click OK to save the query and return
to the Query window.
The query that you just created now appears in the Query list box at the right side of the Query window.
- Click Cancel to return to the HPL main window.
- Using the Column Selection window
The Table button displays the Column Selection window. You can use the Column Selection window to build queries by selecting tables and columns. The ipload utility inserts the selected columns and tables into the appropriate text boxes of the Query-Definition window. - Editing the WHERE clause
When you use the Column Selection window to select a column or columns for the WHERE clause, the selected columns appear in the Where text box.
Parent topic: Define queries
Related reference: