SELECT
Valid in: SQL, DBProc, OpenAPI, ODBC, JDBC, .NET
The SELECT statement retrieves values from tables or views.
The SELECT statement has the following format:
SELECT [ALL | DISTINCT] * | result_expression {,result_expression}
[FROM from_source {, from_source}
[WHERE search_condition]
[GROUP BY column{, column}]
[HAVING search_condition]
{UNION [ALL]
(select)
[ORDER BY result_column [ASC | DESC]
{, result_column [ASC | DESC]}];
where result_expression is one of the following:
• [schema.]table_name.*
Selects all columns
• [[schema.]table_name.]column_name [AS result_column]
Selects one column
• expression [AS] result_column
For SQL-92 compliant installations, the AS keyword in the result expression is optional. All other select syntax and semantics are described in the chapter “OpenSQL Statements.”
Last modified date: 08/28/2024