Previous Topic Next topic Print topic


WHERE Clause Syntax and Description

Restriction: This topic applies to Windows environments only.

Relational databases typically contain many rows of data, with each row constituting a separate record. Most relational database queries retrieve only a portion of the records contained in a table. The WHERE clause qualifies the query command statement to limit the data retrieved to specific rows in the table

The WHERE clause is generally used with a SELECT statement to specify search criteria for retrieving rows of data from a table or group of tables. The WHERE clause can also appear in DELETE and UPDATE command statements.

The optional WHERE clause sets conditions that each record must meet before that record is retrieved by a query. If the SELECT command statement does not include a WHERE clause, every row in the table or tables queried appears in the result.

A predicate states selection criteria that is applied to each row of data values in the table being queried by the SELECT statement. If the data in a particular record matches the selection criteria, then that record is retrieved by the query, otherwise the record is passed over. See Predicates for more information.

WHERE clause selection criteria may include nested subqueries or may connect two or more tables together in a join condition.

Syntax

The WHERE clause format appears below:

WHERE search-condition

where:

search-condition Specifies a predicate (or one or more predicates connected with the AND, OR, or NOT operators).

More:

Previous Topic Next topic Print topic