4.4.11 Select expression

Organization of this subsection
(1) Format
(2) Function
(3) Operands
(4) Syntax rules
(5) Notes
(6) Usage example

(1) Format

select-expression::={{column-specification|column-name}[[Figure]AS[Figure]alias]
          |{value-expression|aggregate-function}[Figure]AS[Figure]alias}

(2) Function

Specifies the item to be output as the result of a search.

(3) Operands

column-specification

For details about specifying columns, see 3.2.5(2) Column specification.

column-name

If there is only one relation reference in the FROM clause that follows, you can specify just a column name.

If the succeeding FROM clause references multiple relations, you must use a column specification.

alias

Specify a unique name in the following cases:

The alias must follow the standard naming rules. For details about the naming rules, see 3.2.4 Specifying names.

All alias names must be unique in any given SELECT clause. Also, you cannot specify a name that is the same as the table ID of another range variable. For details about range variables and table IDs, see 3.2.5 Name qualification.

value-expression

For details about specifying a value expression, see 4.4.19 Value expression.

If you specify a column name for the i-th select expression, that column name is used to reference the i-th column of the relation returned by the relation expression. If you do not specify a column name for the i-th select expression, the following occurs:

aggregate-function

For details about specifying an aggregate function, see 4.4.12 Aggregate functions.

A column specification or column name must be included in the argument of an aggregate function.

(4) Syntax rules

(5) Notes

Only defined stream data can be used for specifying a select expression.

(6) Usage example

Outputs the data in columns a and b of relation s1. The underlined parts indicate select expressions.

REGISTER QUERY q1 SELECT s1.a, s1.b FROM s1[ROWS 100];