Columns; Column References; Derived Column Names; Column Default Settings - HP Neoview SQL Reference Manual

Hide thumbs Also See for Neoview SQL:
Table of Contents

Advertisement

Columns

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
(page
194).

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.

Column Default Settings

You can define specific default settings for columns when the table is created. The CREATE
TABLE statement defines the default settings for columns within tables. The default setting for
a column is the value inserted in a row when an INSERT statement omits a value for a particular
column.

Examples of Derived Column Names

These two examples show how to use names for derived columns.
The first example shows (EXPR) as the column heading of the SELECT result table:
SELECT AVG (salary)
FROM persnl.employee;
(EXPR)
----------------
--- 1 row(s) selected.
The second example shows AVERAGE SALARY as the column heading:
49441.52
"Correlation Names"
Columns
191

Advertisement

Table of Contents
loading

Table of Contents