SELECT Clause

Specifies a projection list for a query.

Syntax

SELECT { expression[AS column]}[,...]

Components

expression An expression that evaluates to a value of the same data type as the corresponding destination column.
column the name of a column in a query destination.

Usage

The expressions within each select list item can contain literals, column names from sources referenced in the FROM clause, operators, scalar functions, and parenthesis. A wild card (*) selects all the columns from underlying sources referenced in the FROM clause. The AS column reference must map to a column name in the destination.

All the items in the projection must use the AS extension to map the items to the destination columns, or none of them should, in which case the assignment is performed left to right. Under some circumstances, a schema can be automatically generated for the destination, based on a query. For expressions, provide a column with the AS extension.

The SELECT clause inside a query specifies a select-list of one or more items. Rows from the datasources listed in the FROM clause are passed to the SELECT clause after being filtered by the WHERE clause, if specified. The results of the expressions in the list are processed by other clauses (if any). The query usually uses the processed select-list results as its input.

These rules apply to the select-list: