The Oracle WHERE clause is used to filter the results from a SELECT, UPDATE, or DELETE statement.
WHERE clauses are not mandatory, but can be used to limit the number of rows affected by a SQL statement (UPDATE, DELETE) or returned by a query (SELECT).
- Arithmetic Operators: =,<>,>,>=,<,<=
- Boolean Operators: AND, OR, NOT
- Special Operators: BETWEEN, IN, LIKE, IS NULL, EXISTS, ...
Example 1:
SELECT * FROM country WHERE countrycode>=34;
Example 2:
SELECT * FROM country WHERE countrycode>=34 AND countryname='France';
Example 3:
SELECT * FROM country WHERE countrycode BETWEEN 12 AND 34;
Example 4:
SELECT * FROM country WHERE countryname LIKE '%Republic%;
Example 5:
SELECT * FROM country WHERE countrycode NOT IN
(SELECT countrycode FROM country_bak);