Previous Topic: SQL OverviewNext Topic: Other Acceptable SQL Keywords


SQL Summary

The following chart summarizes the SQL keywords used most often in queries. The keywords appear on the chart in the order in which they are used in an SQL query or dialog.

Keyword:

Operand:

Explanation:

SELECT

selection-list

Starts an SQL query or dialog. Specifies the data to be retrieved. The items in a selection list can be: column names, mathematical functions, arithmetic expressions, and literal constants.

FROM

table-names

Identifies the table or tables where data can be found.

WHERE

predicate

Tests each row in the named tables. If the result of the test is true, the row is selected. A predicate can be a comparison or a special search condition.

GROUP BY

column-names

Arranges data in groups. Usually used when needed for applying functions (like SUM) to groups of data.

HAVING

predicate

Used with GROUP BY to retrieve rows whose groups meet the search condition.

ORDER BY

select-list-items

Lists column names to specify the order in which data is to be presented. Columns listed must be in the SELECT clause. Ascending order is the default but DESC (descending) can be specified.