The WHERE clause is a part of the SELECT, UPDATE and DELETE DML statements where it determines a subset of records the DML statements will work with.


Syntax of the WHERE clause

WHERE {condition}
Condition is equal to:
[(]attr_name [NOT] <|<=|=|=>|>|IS[ NOT ]NULL|IN|LIKE|BETWEEN value1 [AND value2] [ESCAPE esc_mark]][({values})] [)][ AND|OR] [ condition]



The keyword WHERE is followed by conditions, one condition for one attribute, joined together with taken of AND, OR and round brackets.

attr_name The name of an attribute that's value is to be used.
NOT Negates the rest of an expression.
<, <=, =, =>, > The attribute's value is one of following: less, less or equal, equal, equal or greater, greater than value1.
IS NULL, IS NOT NULL Tests the attribute's value for the null one
IN ({values}) Tests the attribute's value if is it one of {values} value.
LIKE Tests the attribute's value if does it begin with a string represented by value1.
ESCAPE esc_mark In the case when of searching for strings beginning with value1, there must be value1%. The '%' character is called the escape mark. As there may be the need to search for a string containing this character, the ESCAPE gives the way to define new escape mark in the scope of the entire statement.
As the '%'  character means all characters after, the '_' escape mark means only one character after.
In the case of a redefined escape mark, the value must begin and end with '%'. The redefined escape mark must be followed either by the '%' or '_'.
BETWEEN Tests the attribute's value if is it between value1 and value2.