An SQL statement returns data in a table called a result table.
You can specify certain attributes of the result table, such as the column
names, how the rows are ordered, and whether the rows are numbered.
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.
Excluding duplicate rows from the result table of a query
You can ask Db2 to exclude multiple identical rows from a query result table. For example, a query might return multiple rows for each employee when one row per employee is sufficient for your program.
Naming result columns
You can provide your own names for the result table columns for a SELECT statement. This capability is particularly useful for a column that is derived from an expression or a function.
Ordering the result table rows
If you want to guarantee that the rows in your result table are ordered in a particular way, you must specify the order in the SELECT statement. Otherwise, Db2 can return the rows in any order.
Numbering the rows in a result table
Db2 does not number the rows in the result table for a query unless you explicitly request that the rows be numbered.
Ranking the rows
You can request that Db2 calculate the ordinal rank of each row in the result set based on a particular column. For example, you can rank finishing times for a marathon to determine the first, second, and third place finishers.