SQL/MX 2.x Reference Manual (H06.04+)

SQL/MX Language Elements
HP NonStop SQL/MX Reference Manual540440-003
6-6
Columns
Columns
Examples of Derived Column Names
A column is a vertical component of a table and is the relational representation of a
field in a record. A column contains one data value for each row of the table.
A column value is the smallest unit of data that can be selected from or updated in a
table. Each column has a name that is an SQL identifier and is unique within the table
or view that contains the column.
Column References
A qualified column name, or column reference, is a column name qualified by the
name of the table or view to which the column belongs, or by a correlation name.
If a query refers to columns that have the same name but belong to different tables,
you must use a qualified column name to refer to the columns within the query. You
must also refer to a column by a qualified column name if you join a table with itself
within a query to compare one row of the table with other rows in the same table.
The syntax of a column reference or qualified column name is:
{table-name | view-name | correlation-name}.column-name
If you define a correlation name for a table in the FROM clause of a statement, you
must use that correlation name if you need to qualify the column name within the
statement.
If you do not define an explicit correlation name in the FROM clause, you can qualify
the column name with the name of the table or view that contains the column. See
Correlation Names on page 6-10.
Derived Column Names
A derived column is an SQL value expression that appears as an item in the select list
of a SELECT statement. An explicit name for a derived column is an SQL identifier
associated with the derived column.The syntax of a derived column name is:
column-expression [[AS] column-name]
The column expression can simply be a column reference. The expression is optionally
followed by the AS keyword and the name of the derived column.
If you do not assign a name to derived columns, the headings for unnamed columns in
query result tables appear as (EXPR). Use the AS clause to assign names that are
meaningful to you, which is important if you have more than one derived column in
your select list.