Skip to main content

The `WHERE` clause is used to specify criterion for retrieval or modification of rows from objects in a database.

When retrieving or updating rows contained in a database object such as a table, it is often useful to limit the rows affected via specific criteria.

Criteria used to return people with the first name of 'Jack' from a list of employees, might be similar to:

WHERE Employees.FirstName = 'Jack'

There is no hard limit on the number of criteria that can be specified in a WHERE clause. Criteria can be added that are mutually inclusive, through the use of the AND keyword. For instance, if you want to see employees named Jack who were born in 1972, you might write the WHERE clause like:

WHERE Employees.FirstName = 'Jack' AND Employees.BirthYear = 1972

Criteria can be applied such that rows matching any of a number of critera are returned. For instance if you wanted to find employees whose names are either Jack or Jill you might use the following:

WHERE Employees.FirstName = 'Jack' OR Employees.FirstName = 'Jill'