SELECT clauses

The SELECT clause defines the list of attributes on the records produced by the statement.

Its syntax is as follows:

SELECT <expression> AS <attribute key>[, <expression> AS <key>]*
For example:
SELECT Sum(Amount) AS TotalSales

The attribute definitions can refer to previously defined attributes, as shown in the following example:

SELECT Sum(Amount) AS TotalSales, TotalSales / 4 AS QuarterAvg
Note: If an attribute defined in a SELECT clause is used in the statement's GROUP clause, then the expression can only refer to source attributes and other attributes used in the GROUP clause. It must not contain aggregations.