skip to main content
Querying data stores with SQL : Supported SQL and Extensions : Select
  

Try Now

Select

Purpose

The Select statement is used to fetch results from one or more tables.

Syntax

SELECT select_clause
from_clause
[where_clause]
[groupby_clause]
[having_clause]
[{UNION [ALL | DISTINCT] |
{MINUS [DISTINCT] | EXCEPT [DISTINCT]} |
INTERSECT [DISTINCT]} select_statement]
[orderby_clause]
[limit_clause]
where:
select_clause
specifies the columns from which results are to be returned by the query. See Select Clause for a complete explanation.
from_clause
specifies one or more tables on which the other clauses in the query operate. See From Clause for a complete explanation.
where_clause
is optional and restricts the results that are returned by the query. See Where Clause for a complete explanation.
groupby_clause
is optional and allows query results to be aggregated in terms of groups. See Group By Clause for a complete explanation.
having_clause
is optional and specifies conditions for groups of rows (for example, display only the departments that have salaries totaling more than $200,000). See Having Clause for a complete explanation.
UNION
is an optional operator that combines the results of the left and right Select statements into a single result. See Union Operator for a complete explanation.
INTERSECT
is an optional operator that returns a single result by keeping any distinct values from the results of the left and right Select statements. See Intersect Operator for a complete explanation.
EXCEPT | MINUS
are synonymous optional operators that returns a single result by taking the results of the left Select statement and removing the results of the right Select statement. See Except and Minus Operators for a complete explanation.
orderby_clause
is optional and sorts the results that are returned by the query. See Order By Clause for a complete explanation.
limit_clause
is optional and places an upper bound on the number of rows returned in the result. See Limit Clause for a complete explanation.
* Select Clause
* From Clause