ALLBASE/SQL Reference Manual (36216-90216)

Chapter 12 499
SQL Statements S - Z
SELECT
SELECT
The SELECT statement retrieves data from one or more tables or views. The retrieved data
is presented in the form of a table, called the result table or query result. The explanation
of SQL Select syntax is broken down into several levels for easier understanding. An
overview of the syntax at each of these levels is presented here starting with the Select
Statement Level and continuing through the syntax for the FromSpec.
Detailed discussion of each of these syntax levels is presented in the same order, on the
following pages.
Scope
ISQL or Application Programs
SQL Syntax — Select Statement Level
[BULK]
QueryExpression
[ORDER BY {
ColumnID
[ASC
DESC]}[,...]]
SQL Syntax — Subquery Level
(
QueryExpression
)
SQL Syntax — Query Expression Level
{
QueryBlock
(
QueryExpression
)}[UNION [ALL]{
QueryBlock
(
QueryExpreession
)}][...]
SQL Syntax — Query Block Level
SELECT [ALL
DISTINCT]
SelectList
[INTO
HostVariableSpecification
]
FROM
FromSpec
[,...]
[WHERE
SearchCondition1
]
[GROUP BY
GroupColumnList
]
[HAVING
SearchCondition2
]
SelectList
{*
[
Owner.
]
Table.
*
Correlation.Name*
Expression
[[
Owner.
]
Table.
]
ColumnName
CorrelationName.ColumnName
}[,...]
HostVariableSpecification — With BULK Option
:
Buffer
[,:
StartIndex
[,:
NumberOfRows
]]