COLUMN_LIST clause
- Last Updated: January 17, 2024
- 2 minute read
- OpenEdge
- Version 12.8
- Documentation
COLUMN_LIST clause
Specifies which columns to retrieve by the SELECT statement.
Syntax
|
Parameters
- [ ALL | DISTINCT ]
-
Indicates whether a result table omits duplicate rows. ALL is the default and specifies that the result table includes all rows.
DISTINCTspecifies that a table omits duplicate rows. - * |{table_name. |alias. } *
-
Specifies that the result table includes all columns from all tables named in the FROM clause.
- * expr[[ AS ][ ' ]column_alias[ ' ]]
-
Specifies a list of expressions, called a select list, whose results will form columns of the result table. Typically, the expression is a column name from a table named in the
FROMclause. The expression can also be any supported mathematical expression, scalar function, or aggregate function that returns a value.The optional column_alias argument specifies a new heading for the associated column in the result table. You can also use the column_title in an
ORDER BYclause. Enclose the new title in single or double quotation marks if it contains spaces or other special characters, including hyphens.Note: A table alias cannot be used to qualify a column alias. A column alias can only be used without a qualifier because it is not a part of any table definition. - [ table | alias.]column_name , ...]
-
Specifies a list columns from a particular table or alias.
Example
Both these statements return all the columns in the customer table to the select list:
|
The table_name.* syntax is useful when the select list refers to columns in multiple tables and you want to specify all the columns in one of those tables. For example:
|
The following example illustrates using the column_alias option to change the name of the column:
|
You must qualify a column name if it occurs
in more than one table specified in the FROM clause,
as shown:
|
|
When there is a conflict between a SELECT list
alias and an actual database column, OpenEdge SQL interprets the
reference as the database column. Note the following example:
|
In the above query, state is
ambiguous because it can refer to either database column pub.customer.state or
the result of the substring scalar function in the SELECT list.
The ANSI standard requires that state refers unambiguously
to the database column, therefore, the query groups the result by
the database column. The same principle holds true for ambiguous
references that appear in WHERE, ON,
and HAVING clauses.