background image
<< Rules for SQL92 identifiers | new-table-Name >>

column-Name

<< Rules for SQL92 identifiers | new-table-Name >>
Derby Reference Manual
19
Qualifying dictionary objects
Since some dictionary objects can be contained within other objects, you can qualify
those dictionary object names. Each component is separated from the next by a period.
An SQL92Identifier is "dot-separated." You qualify a dictionary object name in order to
avoid ambiguity.
column-Name
In many places in the SQL syntax, you can represent the name of a column by qualifying
it with a table-Name or correlation-Name.
In some situations, you cannot qualify a column-Name with a table-Name or a
correlation-Name, but must use a
Simple-column-Name
instead. Those situations are:
· creating a table (
CREATE TABLE statement
)
· specifying updatable columns in a cursor
· in a column's correlation name in a SELECT expression (see
SelectExpression
)
· in a column's correlation name in a TableExpression (see
TableExpression
)
You cannot use correlation-Names for updatable columns; using correlation-Names in
this way will cause an SQL exception. For example:
SELECT c11 AS col1, c12 AS col2, c13 FROM t1 FOR UPDATE of c11,c13
In this example, the correlation-Name
col1 FOR c11
is not permitted because
c11
is
listed in the FOR UPDATE list of columns. You can use the correlation-Name
FOR c12
because it is not in the FOR UPDATE list.
Syntax
[ {
table-Name
|
correlation-Name
} . ]
SQL92Identifier
Example
-- C.Country is a column-Name qualified with a
--
correlation-Name
.
SELECT C.Country
FROM APP.Countries C
correlation-Name
A correlation-Name is given to a table expression in a FROM clause as a new name or
alias for that table. You do not qualify a correlation-Name with a schema-Name.
You cannot use correlation-Names for updatable columns; using correlation-Names in
this way will cause an SQL exception. For example:
SELECT c11 AS col1, c12 AS col2, c13 FROM t1 FOR UPDATE of c11,c13
In this example, the correlation-Name
col1 FOR c11
is not permitted because
c11
is
listed in the FOR UPDATE list of columns. You can use the correlation-Name
FOR c12
because it is not in the FOR UPDATE list.
Syntax
SQL92Identifier
Example
-- C is a correlation-Name
SELECT C.NAME
FROM SAMP.STAFF C