Result tables
The data that is retrieved by an SQL statement is always in the form of a table, which is called a result table. Like the tables from which you retrieve the data, a result table has rows and columns. A program fetches this data one row at a time.
Example result table: Assume that you issue the following
SELECT statement, which retrieves the last name, first name, and phone
number of employees in department D11 from the sample employee table:
SELECT LASTNAME, FIRSTNME, PHONENO
FROM DSN8D10.EMP
WHERE WORKDEPT = 'D11'
ORDER BY LASTNAME;The result table looks similar to the following output:
LASTNAME FIRSTNME PHONENO
================ ============== ==========
ADAMSON BRUCE 4510
BROWN DAVID 4501
JOHN REBA 0672
JONES WILLIAM 0942
LUTZ JENNIFER 0672
PIANKA ELIZABETH 3782
SCOUTTEN MARILYN 1682
STERN IRVING 6432
WALKER JAMES 2986
YAMAMOTO KIYOSHI 2890
YOSHIMURA MASATOSHI 2890