Specifies a projection list for a query.
SELECT [expression[AS column]] [,...]
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. |
The expressions within each select-list item can contain literals, column names, operators, scalar functions, and parentheses. A query select-list expression can also include aggregate functions. Column names use the syntax source.column-name, where source is the name or alias of one of the data sources listed in the FROM clause. A wildcard (*) selects all columns from all data sources referenced in the FROM clause, from left to right. The syntax source.* selects all columns from the specified data source.
Each select-list item can use the AS clause to indicate the column within the destination to which the select-list item should be published. The AS clause must be used for either all or none of the items in the select-list. If it is not used, the assignment is performed left to right. Under some circumstances, a schema can be automatically generated for the destination, based on a query.
The SELECT clause inside a query specifies a select-list of one or more items. Rows from the data sources 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.
This example uses the SELECT clause with a column name and an aggregate function as its expressions:
CREATE OUTPUT WINDOW MaximumPrices PRIMARY KEY DEDUCED KEEP ALL AS SELECT Trades.Symbol, max(Trades.Price) MaxPrice FROM Trades GROUP BY T.Symbol