FairCom Corporation


2.27 SELECT


Description

Selects the specified column values from one or more rows contained in the table(s) specified in the FROM clause. The selection of rows is restricted by the WHERE clause. The temporary table derived through the clauses of a select statement is called a result table.

The format of the SELECT statement is a query expression with optional ORDER BY and FOR UPDATE clauses. For more detail on query expressions, see Section 1.2.6 "Query Expressions" on page 1-9.

Syntax

select_statement ::
query_expression
ORDER BY { expr | posn } [ ASC | DESC ]
[ , { expr | posn } [ASC | DESC] ,... ]
FOR UPDATE [ OF [table].column_name, ... ] [ NOWAIT ];
query_expression ::
query_specification
| query_expression set_operator query_expression
| ( query_expression )
set_operator ::
{ UNION [ ALL ] | INTERSECT | MINUS }
query_specification ::
SELECT [ALL | DISTINCT]
{
*
| { table_name | alias } . * [, { table_name | alias } . * ] ...
| expr [ [ AS ] [ ' ] column_title [ ' ] ] [, expr [ [ AS ] [ ' ] column_title [ ' ] ] ] ...
}
FROM table_ref [ { ctree ORDERED } ] [ , table_ref [ { ctree ORDERED } ] ...
[ WHERE search_condition ]
[ GROUP BY [table.]column_name
[, [table.]column_name ] ...
[ HAVING search_condition ]
table_ref ::
table_name [ AS ] [ alias [ ( column_alias [ , ... ] ) ] ]
| ( query_expression ) [ AS ] alias [ ( column_alias [ , ... ] ) ]
| [ ( ] joined_table [ ) ]
joined_table ::
table_ref CROSS JOIN table_ref
| table_ref [ INNER | LEFT [ OUTER ] ] JOIN table_ref ON search_condition

Arguments

query_expression
See Section 1.2.6 "Query Expressions" on page 1-9.

ORDER BY clause
See Section 2.28 "ORDER BY CLAUSE" on page 2-47.

FOR UPDATE clause
See Section 2.32 "UPDATE" on page 2-52.

Authorization

The user executing this statement must have any of the following privileges:


FairCom Corporation
www.faircom.com