NonStop SQL/MP Reference Manual

Table Of Contents
NonStop SQL/MP Reference Manual142115
C-40
Examples—Column Identifiers
COL number
specifies the column in position number of the select list. The first item in the
select list is COL 1. You can use this form to refer to literals and expressions.
alias
is defined in a NAME command. You can use this form to refer to a name you
assign to a literal or expression. See Alias on page A-6 for more information.
detail-alias
is a detail alias name defined in the NAME clause of a DETAIL command. You can
use a detail alias name as a column identifier in any command except DETAIL. See
Detail Alias on page D-43 for more information.
Examples—Column Identifiers
Following are different ways to designate the same column:
SELECT DEPTNUM FROM $SQL.PERSNL.EMPLOYEE;
SELECT EMPLOYEE.DEPTNUM FROM $SQL.PERSNL.EMPLOYEE;
SELECT DNUM FROM $SQL.PERSNL.EMPLOYEE;
Columns
A column is a vertical component of a table, the relational representation of a field in a
record. A column contains one data value for each row of the table.
Each SQL column has a name that is an SQL identifier that is unique within the table or
view that contains the column.
A qualified column name 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 or views, you must use a qualified
column name to refer to the columns within the query. The syntax of a qualified column
name is as follows:
If you define a correlation name for a column in the FROM clause of a statement, you
must use that correlation name (called the “explicit 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 (called the
“implicit correlation name”). You can also use the name of a DEFINE that contains the
{ table-name }
{ view-name }.column-name
{ correlation-name }