Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

Query overview Next Page

Querying and the SELECT statement


The SELECT statement retrieves information from a database for use by the client application. SELECT statements are also called queries. The information is delivered to the client in the form of a result set. The client application can then process the result set. For example, Interactive SQL displays the result set in the Results pane. Result sets consist of a set of rows, just like tables in the database.

SELECT statements can contain several parts, or clauses. In the following SELECT syntax, each new line is a separate clause. Only the more common clauses are listed here.

SELECT select-list
[ FROM table-expression ]
[ WHERE search-condition ]
[ GROUP BY column-name ]
[ HAVING search-condition ]
[ ORDER BY { expression | integer } ]

The clauses in the SELECT statement are as follows:

Most of the clauses are optional, but if they are included then they must appear in the correct order.

For more information about the SELECT statement syntax, see SELECT statement.