ALLBASE/SQL Reference Manual (36216-90216)

500 Chapter12
SQL Statements S - Z
SELECT
HostVariableSpecification — Without BULK Option
{:
HostVariable
[ [ INDICATOR] :
Indicator
] ) [,...]
FromSpec
{
TableSpec
(
FromSpec
)
FromSpec
NATURAL [INNER
LEFT [OUTER]
RIGHT [OUTER]] JOIN {
TableSpec
(
FromSpec
)}
FromSpec
[INNER
LEFT [OUTER]
RIGHT [OUTER]] JOIN {
TableSpec
(
FromSpec
)}{ON
SearchCondition3
USING (
ColumnList
)}}
TableSpec
[
Owner
.]
TableName
[
CorrelationName
]
A SELECT statement can be examined at the following four levels:
Select Statement A select statement is a syntactically complete SQL statement
containing one or more SELECT statements but having a single query
result that can optionally be sorted with an ORDER BY clause. At its
simplest, a select statement is a query expression consisting of a single
query block.
Subquery A subquery (also known as a nested query) is a query expression enclosed
in parentheses and embedded in a search condition. A subquery returns a
value which is used in evaluating the search condition.
Query Expression A query expression is a complex expression consisting of one or more
query blocks and UNION/UNION ALL operators.
Query Block A query block is the primary query syntax for specifying which tables to
query and which columns to return.
The syntax and usage of each of these levels is described below. For
additional information, refer to the chapter "SQL Queries."
SQL Syntax — Select Statement Level
[BULK]
QueryExpression
[ORDER BY {
ColumnID
[ASC
DESC]}[,...]]
Parameters — Select Statement Level
BULK is specified in an application program to retrieve multiple rows with a
single execution of the SELECT statement.
Do not use this option in select statements associated with a cursor.
Instead, use the BULK option of the FETCH statement.