The SELECT list between the SELECT and FROM keywords specifies expressions that form the output rows of the SELECT statement. The expressions can refer to columns computed in the FROM clause. You can specify another name for an output column by using the AS output_name clause. This name is used to label the column to be displayed. It can also be used to refer to the column value in the ORDER BY and GROUP BY clauses instead of the WHERE or HAVING clause. In this case, you must write out the expression.

You can enter an asterisk (*) instead of an expression in the output list to indicate all columns of the selected rows.

Examples

The SELECT list in the following example specifies that the result set includes the empno column, the ename column, the mgr column, and the hiredate column.

SELECT empno, ename, mgr, hiredate FROM emp;

 empno | ename  | mgr  |      hiredate
-------+--------+------+--------------------
  7934 | MILLER | 7782 | 23-JAN-82 00:00:00
  7782 | CLARK  | 7839 | 09-JUN-81 00:00:00
  7839 | KING   |      | 17-NOV-81 00:00:00
  7788 | SCOTT  | 7566 | 19-APR-87 00:00:00
  7566 | JONES  | 7839 | 02-APR-81 00:00:00
  7369 | SMITH  | 7902 | 17-DEC-80 00:00:00
  7876 | ADAMS  | 7788 | 23-MAY-87 00:00:00
  7902 | FORD   | 7566 | 03-DEC-81 00:00:00
  7521 | WARD   | 7698 | 22-FEB-81 00:00:00
  7844 | TURNER | 7698 | 08-SEP-81 00:00:00
  7499 | ALLEN  | 7698 | 20-FEB-81 00:00:00
  7698 | BLAKE  | 7839 | 01-MAY-81 00:00:00
  7654 | MARTIN | 7698 | 28-SEP-81 00:00:00
  7900 | JAMES  | 7698 | 03-DEC-81 00:00:00
(14 rows)