WHERE clause
The WHERE
clause specifies the conditions that records must meet to be retrieved. The WHERE
clause contains conditions in the form:
Copy
WHERE expr1 rel_operator expr2
expr1
and expr2
can be field names, constant values, or expressions.
rel_operator
is the relational operator that links the two expressions.
Retrieve the names of employees who make $20,000 or more.
Copy
SELECT last_name,first_name FROM emp WHERE salary >= 20000
The WHERE
clause can also use expressions such as these:
Copy
WHERE expr1 IS NULL
WHERE NOT expr2
Note If you use fully qualified names in the SELECT
(projection) list, you must also use fully qualified names in the related WHERE
clause.