When you have the query result on your display, you can look at it, and perhaps print it. You can manipulate query results shown on your display by using ISQL display commands. The following sections show how to look at the entire query results when it does not all fit on your display, and how to direct the query result to a printer.
When your query results are larger than a single display, you must know the display commands with which you can view different portions of the query result. The following examples show how to use the other display commands to query longer and wider tables.
Type the following query and press ENTER:
select * - from proj_act - where projno <> 'AD3111' - order by actno,acendate
This query selects all the rows that contain project numbers other than AD3111 in the column named PROJNO from the PROJ_ACT table. It produces a result similar to the display in Figure 11.
Figure 11. Example of a Long Query Result
+--------------------------------------------------------------------------------+ | PROJNO ACTNO ACSTAFF ACSTDATE ACENDATE | | ------ ------ ------- ---------- ---------- | | AD3100 10 0.50 1982-01-01 1982-07-01 | | MA2100 10 0.50 1982-01-01 1982-11-01 | | IF2000 10 0.50 1982-01-01 1983-01-01 | | IF1000 10 0.50 1982-06-01 1983-01-01 | | IF1000 10 0.50 1982-01-01 1983-01-01 | | AD3110 10 1.00 1982-01-01 1983-01-01 | | OP1000 10 0.25 1982-01-01 1983-02-01 | | OP1010 10 1.00 1982-01-01 1983-02-01 | | OP2010 10 1.00 1982-01-01 1983-02-01 | | MA2110 10 1.00 1982-01-01 1983-02-01 | | MA2100 20 1.00 1982-01-01 1982-03-01 | | PL2100 30 1.00 1982-02-01 1982-09-01 | | PL2100 30 1.00 1982-01-01 1982-09-15 | | MA2111 40 1.00 1982-01-01 1983-02-01 | | MA2111 50 1.00 1982-01-01 1982-06-01 | | OP2000 50 0.75 1982-01-01 1983-02-01 | | AD3112 60 0.75 1982-01-01 1982-03-15 | | AD3112 60 0.50 1982-02-01 1982-03-15 | | MA2112 60 2.00 1982-01-01 1982-07-01 | | AD3113 60 1.00 1982-04-01 1982-09-01 | | MA2113 60 1.00 1982-02-15 1982-09-01 | | AD3113 60 0.75 1982-03-01 1982-10-15 | +--------------------------------------------------------------------------------+
This query result is used in the following topics. Do not end it yet.
The query results that you are retrieving are longer than can be shown on one display. To see the remaining portions of the query result, you must know how to scroll forward through it. Usually, the command to scroll forward 20 rows is FORWARD 20.
Instead of entering FORWARD 20, take advantage of the special function of the ENTER key on query results. While viewing a query result, pressing ENTER without having a command in the input area repeats the previous display command. If there was no previous display command entered, the length of the display is scrolled forward. If the previous command is BACKWARD MAX and the display starts from the beginning of the table, press ENTER to scroll forward the length of the display.
Press ENTER. On a 24 X 80 terminal you see a result similar to the display in Figure 12.
Figure 12. Display 20 Rows Forward by Pressing ENTER
+--------------------------------------------------------------------------------+ | PROJNO ACTNO ACSTAFF ACSTDATE ACENDATE | | ------ ------ ------- ---------- ---------- | | AD3112 70 0.50 1982-02-01 1982-03-15 | | AD3113 70 0.50 1982-06-15 1982-07-01 | | AD3112 70 1.00 1982-03-15 1982-08-15 | | MA2112 70 1.00 1982-02-01 1982-10-01 | | AD3112 70 0.75 1982-01-01 1982-10-15 | | AD3112 70 0.25 1982-08-15 1982-10-15 | | AD3113 70 0.75 1982-09-01 1982-10-15 | | AD3113 70 1.25 1982-06-01 1982-12-15 | | MA2112 70 1.50 1982-02-15 1983-02-01 | | AD3113 70 1.00 1982-07-01 1983-02-01 | | AD3113 70 1.00 1982-10-15 1983-02-01 | | MA2112 70 1.00 1982-06-01 1983-02-01 | | MA2113 70 2.00 1982-04-01 1983-12-15 | | AD3113 80 1.75 1982-01-01 1982-04-15 | | AD3113 80 0.50 1982-03-01 1982-04-15 | | AD3112 80 0.50 1982-10-15 1982-12-01 | | AD3112 80 0.35 1982-08-15 1982-12-01 | | MA2113 80 0.50 1982-10-01 1983-02-01 | | MA2113 80 1.50 1982-09-01 1983-02-01 | | MA2113 80 1.00 1982-01-01 1983-02-01 | | MA2112 80 1.00 1982-10-01 1983-10-01 | | IF1000 90 0.50 1982-10-01 1983-01-01 | +--------------------------------------------------------------------------------+
To scroll through the query result a half display at a time, you can either enter FORWARD or press PF8.
The rows on the display scroll half the display. The middle row of the previous display is now the first row of the new display.
Now, to move forward to the remaining rows, enter:
forward max
This results in a display similar to Figure 13.
Figure 13. Display after Moving to the End of the Query Result
+--------------------------------------------------------------------------------+ | PROJNO ACTNO ACSTAFF ACSTDATE ACENDATE | | ------ ------ ------- ---------- ---------- | | IF1000 90 0.50 1982-10-01 1983-01-01 | | IF1000 90 1.00 1982-01-01 1983-01-01 | | IF2000 100 0.50 1982-03-01 1982-07-01 | | IF2000 100 0.75 1982-01-01 1982-07-01 | | IF1000 100 0.50 1982-10-01 1983-01-01 | | IF2000 110 0.50 1982-03-01 1982-07-01 | | IF2000 110 0.50 1982-10-01 1983-01-01 | | OP1010 130 4.00 1982-01-01 1983-02-01 | | OP2012 140 0.25 1982-01-01 1983-02-01 | | OP2011 140 0.75 1982-01-01 1983-02-01 | | OP2013 140 0.50 1982-01-01 1983-02-01 | | OP2011 150 0.25 1982-01-01 1983-02-01 | | OP2012 160 0.75 1982-01-01 1983-02-01 | | OP2013 170 0.50 1982-01-01 1983-02-01 | | AD3113 180 1.00 1982-04-15 1982-06-01 | | AD3113 180 0.50 1982-06-01 1982-07-01 | | AD3113 180 0.75 1982-03-01 1982-07-01 | | AD3112 180 0.50 1982-08-15 1983-01-01 | | MA2113 180 0.50 1982-10-01 1983-01-01 | | MA2112 180 1.00 1982-07-01 1983-02-01 | | MA2112 180 1.00 1982-07-15 1983-02-01 | | * End of Result *** 70 Rows Displayed ***Cost Estimate is 1******************* | +--------------------------------------------------------------------------------+
To move back through the query result, use a BACKWARD command. Also, you can use PF7 to move your view of the result backward one-half display. Moving back through the query result is limited; you can move back only to a limit of one full display from the last FORWARD command. If you want to go farther back, you must return directly to the beginning of the query result.
For example, to view the previous 15 rows, enter:
backward 15
This command presents the display in Figure 14.
Figure 14. Results When You Try to Exceed the Limit of a Full Display
+--------------------------------------------------------------------------------+ | PROJNO ACTNO ACSTAFF ACSTDATE ACENDATE | | ------ ------ ------- ---------- ---------- | | AD3112 70 0.50 1982-02-01 1982-03-15 | | AD3113 70 0.50 1982-06-15 1982-07-01 | | AD3112 70 1.00 1982-03-15 1982-08-15 | | MA2112 70 1.00 1982-02-01 1982-10-01 | | AD3112 70 0.75 1982-01-01 1982-10-15 | | AD3112 70 0.25 1982-08-15 1982-10-15 | | AD3113 70 0.75 1982-09-01 1982-10-15 | | AD3113 70 1.25 1982-06-01 1982-12-15 | | MA2112 70 1.50 1982-02-15 1983-02-01 | | AD3113 70 1.00 1982-07-01 1983-02-01 | | AD3113 70 1.00 1982-10-15 1983-02-01 | | MA2112 70 1.00 1982-06-01 1983-02-01 | | MA2113 70 2.00 1982-04-01 1983-12-15 | | AD3113 80 1.75 1982-01-01 1982-04-15 | | AD3113 80 0.50 1982-03-01 1982-04-15 | | AD3112 80 0.50 1982-10-15 1982-12-01 | | AD3112 80 0.35 1982-08-15 1982-12-01 | | MA2113 80 0.50 1982-10-01 1983-02-01 | | MA2113 80 1.50 1982-09-01 1983-02-01 | | MA2113 80 1.00 1982-01-01 1983-02-01 | | MA2112 80 1.00 1982-10-01 1983-10-01 | | IF1000 90 0.50 1982-10-01 1983-01-01 | +--------------------------------------------------------------------------------+
The view is moved back to the limit of one full display. Enter the following command to return to the first rows of the query result:
backward max
Now that you are finished with this query result, end it.
To learn about viewing results that are too wide for a single display, it is necessary to use a sample table of greater width than the PROJ_ACT table. For the next several examples, the EMPLOYEE table is used.
Enter the following query:
select * - from employee
The resulting query on an 80-character display is similar to Figure 15.
Figure 15. Results of Query That is Too Wide for Display
+--------------------------------------------------------------------------------+ | EMPNO FIRSTNME MIDINIT LASTNAME WORKDEPT PHONENO HIREDATE | | ----- ------------ ------- --------------- -------- ------- ---------- | | 000010 CHRISTINE I HAAS A00 3978 1991-05-27 | | 000110 VINCENZO G LUCCHESI A00 3490 1958-05-16 | | 000120 SEAN O'CONNELL A00 2167 1963-12-05 | | 000020 MICHAEL L THOMPSON B01 3476 1973-10-10 | | 000030 SALLY A KWAN C01 4738 1975-04-05 | | 000130 DOLORES M QUINTANA C01 4578 1971-07-28 | | 000140 HEATHER A NICHOLLS C01 1793 1976-12-15 | | 000060 IRVING F STERN D11 6423 1973-09-14 | | 000150 BRUCE ADAMSON D11 4510 1972-02-12 | | 000160 ELIZABETH R PIANKA D11 3782 1977-10-11 | | 000170 MASATOSHI J YOSHIMURA D11 2890 1978-09-15 | | 000180 MARILYN S SCOUTTEN D11 1682 1973-07-07 | | 000190 JAMES H WALKER D11 2986 1974-07-26 | | 000200 DAVID BROWN D11 4501 1966-03-03 | | 000210 WILLIAM T JONES D11 0942 1979-04-11 | | 000220 JENNIFER K LUTZ D11 0672 1968-08-29 | | 000070 EVA D PULASKI D21 7831 1980-09-30 | | 000230 JAMES J JEFFERSON D21 2094 1966-11-21 | | 000240 SALVATORE M MARINO D21 3780 1979-12-05 | | 000250 DANIEL S SMITH D21 0961 1969-10-30 | | 000260 SYBIL P JOHNSON D21 8953 1975-09-11 | | 000270 MARIA L PEREZ D21 9001 1980-09-30 | +--------------------------------------------------------------------------------+
There is no visual indication that this query result is too wide for the display; however, because the columns extend to the far right side of the display, there is a possibility that additional columns of data may be beyond the last column. To search for any additional columns that may exist, enter the following display command:
right 7
This moves your view of the query seven columns to the right, resulting in Figure 16.
Figure 16. Display of Query Moved Seven Columns to the Right
+--------------------------------------------------------------------------------+ | JOB EDLEVEL SEX BIRTHDATE SALARY BONUS COMM | | -------- ------- --- ---------- ----------- ----------- ----------- | | PRES 18 F 1933-08-01 52750.00 1000.00 4220.00 | | SALESREP 19 M 1929-11-05 46500.00 800.00 3720.00 | | CLERK 14 M 1942-10-18 29250.00 600.00 2340.00 | | MANAGER 18 M 1948-02-02 41250.00 800.00 3300.00 | | MANAGER 20 F 1941-05-11 38250.00 800.00 3060.00 | | ANALYST 16 F 1925-09-15 23800.00 800.00 1904.00 | | ANALYST 18 F 1946-01-19 28420.00 800.00 2274.00 | | MANAGER 16 M 1945-07-07 32250.00 600.00 2580.00 | | DESIGNER 16 M 1947-05-17 25280.00 500.00 2022.00 | | DESIGNER 17 F 1955-04-12 22250.00 400.00 1780.00 | | DESIGNER 16 M 1951-01-05 24680.00 500.00 1974.00 | | DESIGNER 17 F 1949-02-21 21340.00 500.00 1707.00 | | DESIGNER 16 M 1952-06-25 20450.00 400.00 1636.00 | | DESIGNER 16 M 1941-05-29 27740.00 600.00 2217.00 | | DESIGNER 17 M 1953-02-23 18270.00 400.00 1462.00 | | DESIGNER 18 F 1948-03-19 29840.00 600.00 2387.00 | | MANAGER 16 F 1953-05-26 36170.00 700.00 2893.00 | | CLERK 14 M 1935-05-30 22180.00 400.00 1774.00 | | CLERK 17 M 1954-03-31 28760.00 600.00 2301.00 | | CLERK 15 M 1939-11-12 19180.00 400.00 1534.00 | | CLERK 16 F 1936-10-05 1725.00 300.00 1380.00 | | CLERK 15 F 1953-05-26 27380.00 500.00 2190.00 | +--------------------------------------------------------------------------------+
Now you can see that there are an additional seven columns, but it is still not clear that you have reached the last column of the table. Enter the following command to move your view two more columns to the right:
right 2
You should now see the display in Figure 17.
Figure 17. Display of Query Moved Two More Columns to the Right
+--------------------------------------------------------------------------------+ | SEX BIRTHDATE SALARY BONUS COMM | | --- ---------- ----------- ----------- ----------- | | F 1933-08-01 52750.00 1000.00 4220.00 | | M 1929-11-05 46500.00 800.00 3720.00 | | M 1942-10-18 29250.00 600.00 2340.00 | | M 1948-02-02 41250.00 800.00 3300.00 | | F 1941-05-11 38250.00 800.00 3060.00 | | F 1925-09-15 23800.00 800.00 1904.00 | | F 1946-01-19 28420.00 800.00 2274.00 | | M 1945-07-07 32250.00 600.00 2580.00 | | M 1947-05-17 25280.00 500.00 2022.00 | | F 1955-04-12 22250.00 400.00 1780.00 | | M 1951-01-05 24680.00 500.00 1974.00 | | F 1949-02-21 21340.00 500.00 1707.00 | | M 1952-06-25 20450.00 400.00 1636.00 | | M 1941-05-29 27740.00 600.00 2217.00 | | M 1953-02-23 18270.00 400.00 1462.00 | | F 1948-03-19 29840.00 600.00 2387.00 | | F 1953-05-26 36170.00 700.00 2893.00 | | M 1935-05-30 22180.00 400.00 1774.00 | | M 1954-03-31 28760.00 600.00 2301.00 | | M 1939-11-12 19180.00 400.00 1534.00 | | F 1936-10-05 1725.00 300.00 1380.00 | | F 1953-05-26 27380.00 500.00 2190.00 | +--------------------------------------------------------------------------------+
Now apparently COMM is the final column in the table, because no other columns appear to the right of it in the query result. If you only want to move your view of the table one column to the right, you can omit the number and just type right. You can also move your view one column to the right by pressing PF11.
To move your view to the left, type:
left
This command works in the same manner as RIGHT. Again, you can move your view one column to the left by pressing PF10.
Now move your view all the way back to the first column by using the following command:
column 1
The COLUMN command aligns the column you specify with the left edge of the display. The number refers to the column's position in the query result. If you do not specify a number with the COLUMN command, column 1 is placed at the left edge of the display.
A column of characters that is wider than the display width requires another display command, TAB, to let you see the entire length attribute of a column. The TAB command is described in Chapter 10, ISQL Commands.