In SQL, the WHERE clause limits the processing of a query by defining the criteria each row must meet to be acceptable. It immediately follows the FROM clause. WHERE is one of the workhorse keywords in SQL because it is used so often in nearly every kind of query. SELECT statements use WHERE to limit the output. In UPDATE and DELETE statements, WHERE is used to limit the number of rows affected. To my knowledge, there is no reason to have a WHERE clause in an INSERT statement, nor do I believe any query engines allow it.

The WHERE clause causes the row to be returned as output or the statement to execute if the specified criteria, called the predicate, returns a true value. The predicate is merely a logical expression. The predicate can be as simple as specifying a constant value a particular column must have, or it can consist of a complicated subquery or correlated subquery.

As a logical expression, the predicate can use any of the logical operators (AND, OR, NOT, etc.) to create compound expressions. There is no limit to the number of expressions in the predicate or complexity except for the processing power of the computer on which the query runs. The predicate also makes use of the relational operators to compare one term of the expression to the other.

The simplest WHERE clauses takes the form

  ... WHERE column_name = "value" ...
Parentheses may be used in more complex queries to help the query appear more readible or to alter the order of precedence of the relational operators.
   ... WHERE (column1 > "value1") AND 
              (column2 < "value2") ... 
See my writeups on subqueries and correlated subqueries to see examples of more complicated predicates.