Column names

The meaning of a column name depends on its context.

A column name can be used to:

  • Declare the name of a column, as in a CREATE TABLE statement.
  • Identify a column, as in a CREATE INDEX statement.
  • Specify values of the column, as in the following contexts:
    • In an aggregate function, a column name specifies all values of the column in the group or intermediate result table to which the function is applied. Groups and intermediate result tables are explained under Queries. For example, MAX(SALARY) applies the function MAX to all values of the column SALARY in a group.
    • In a GROUP BY or ORDER BY clause, a column name specifies all values in the intermediate result table to which the clause is applied. For example, ORDER BY DEPT orders an intermediate result table by the values of the column DEPT.
    • In an expression, a search condition, or a scalar function, a column name specifies a value for each row or group to which the construct is applied. For example, when the search condition CODE = 20 is applied to some row, the value specified by the column name CODE is the value of the column CODE in that row.
  • Provide a column name for an expression to temporarily rename a column, as in the correlation-clause of a table-reference in a FROM clause, or in the AS clause in the select-clause.