Was this helpful?
SELECT (interactive)
Valid in: SQL, OpenAPI, ODBC, JDBC, .NET
The SELECT (interactive) statement returns values from tables or views.
The SELECT (interactive) statement has the following format:
SELECT [FIRST rowCount] [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.]tablename.*
Selects all columns
[[schema.]tablename.]columnname [[AS] result_column]
Selects one column
expression [AS] result_column
The SELECT statement returns values from one or more tables or views in the form of a single result table. Using the various clauses of the SELECT statement, you can specify:
Qualifications for the values in the result table
Sorting and grouping of the values in the result table
This statement description presents details of the SELECT statement in interactive OpenSQL (ISQL). In ISQL the results of a query are displayed on your terminal. In embedded OpenSQL (ESQL), results are returned in host language variables. For details about using the SELECT statement in ESQL, see SELECT (embedded).
The following sections describe the clauses of the SELECT statement, explain how to create simple queries, and explain how the results of a query are obtained.
Last modified date: 08/28/2024