3.2.5 Name qualification

Name qualification is used to make a name unique by concatenating a data identifier and a column name using a period (.), as in data-identifier.column-name. This form of name qualification is called column specification.

Organization of this subsection
(1) Data identifier specification
(2) Column specification
(3) Range variable

(1) Data identifier specification

When two or more data identifiers are specified in a single CQL statement, a qualifier is used to uniquely associate each specified column name to a stream, relation or alias. This is called data identifier specification.

As shown in the following specification format, a stream name, relation name, or alias is specified as the qualifier.

Data identifier specification format
data-identifier::={stream-name | relation-name | alias}

For details about stream names and relation names, see 4.4.14 Relation reference. For aliases, see 4.4.11 Select expression and 4.4.14 Relation reference.

(2) Column specification

A column name qualified by a data identifier is called column specification.

When executing a search that uses multiple data identifiers (a search in which two or more data identifiers are linked), more than one search-target data identifier may contain columns having the same name. In such a case, column specification clearly identifies the data identifier that corresponds to the specified column.

The specification format follows:

Format for column specification
column-specification::=data-identifier.column-name

When using a data identifier to qualify a column name, the specified data identifier must specify a column name that is within its valid range. A valid range of data identifiers means the column names defined by reference to relations, streams, or aliases in the FROM clause. If an undefined column name is specified, an error occurs.

For the name of the stream or relation returned as a result of an inquiry, the name of the query in which the inquiry is defined is used.

A column name is included with either of the following:

The column name for the stream or relation is returned in the query result according to the rules described below.

For details about the stream clause, see 4.4.2 Stream clause. For details about the relation expression, see 4.4.3 Relation expression.

(3) Range variable

The identifier used as the qualifier for column specification is called a range variable. A range variable has a valid range and a name. A data identifier specified using a range variable is also called a table ID.

An alias is a range variable. When an alias is specified, the source data identifier specified for the alias is no longer a valid range for the column name.

Examples of the valid range for column names when an alias is specified in a relation reference or select expression are described below.