The SELECT statement consists of several clauses including:
Clause | Purpose | Where to define it in the SQL builder |
---|---|---|
SELECT | Specifies the columns of the results table. SELECT * is the default. The default statement retains all rows of the results table, and does not eliminate redundant duplicates. SELECT DISTINCT eliminates all but one of each set of duplicate rows of the results table. | Use the Columns page in the Design pane to add columns or expressions to the SELECT clause. |
FROM | Specifies the tables to be used in the query. You can assign aliases to tables to reduce complexity or ambiguity in a statement. | Use the Tables pane to add tables to the statement. |
WHERE | Defines conditions that determine whether rows are included in the results table of the SELECT statement. | Use the Conditions page in the Design pane to add a WHERE clause. |
GROUP BY | Describes how the rows in the results table are grouped. You can also define nested grouping expressions. | Use the Groups page in the Design pane to add the grouping expressions for the SELECT statement. |
HAVING | Defines conditions for groups. | Use the Group Conditions page to add the conditions for a HAVING clause. |
ORDER BY | Controls the order of the rows presented in the results table. You can select which column expression in the SELECT clause to use to define the order of the rows in the results table. | Use the Columns page in the Design pane to add an ORDER BY clause. |
See your database vendor documentation for information about the syntax of SELECT statements. Different database vendors use different syntax.