SELECT statement

The SELECT statement retrieves data from a database and returns it in the form of a table. It can be embedded in an application or used interactively.

The SELECT statement is made up of several clauses including:

Clause Purpose Where to define it
SELECT The SELECT clause specifies the columns of the final results table. SELECT * is the default. It retains all rows of the final result table, and does not eliminate redundant duplicates. SELECT DISTINCT eliminates all but one of each set of duplicate rows of the final result table. Use the Columns tab in the Design pane to add columns or expressions to your SELECT clause.
FROM The FROM clause specifies the tables to be used in the query. Tables can be given an alias to reduce complexity or ambiguity in a statement. Use the Tables pane to add tables to your query.
WHERE The WHERE clause defines conditions that determine whether rows will be included in the result set of the SELECT statement. The WHERE clause is specified on the Conditions tab of the Design pane.
ORDER BY The ORDER BY clause controls the order of the rows presented in the result set. You can select which column expression in the SELECT clause should be used to define the order of the result set rows. Use the Columns tab in the Design pane to create an ORDER BY clause.
GROUP BY The GROUP BY clause describes how the result set rows should be grouped. Nested grouping expressions can also be defined. Use the Groups tab in the Design pane to specify the grouping expressions for your SELECT statement.
HAVING The HAVING clause is used to define a condition for groups. The Group Conditions tab allows you to define the conditions for a HAVING clause.

 

Parent topic

Creating a SELECT statement