Recipe 2. Retrieving a Subset of Rows from a Table
17 October, 2006
Problem
You have a table and want to see only rows that satisfy a specific condition.
Solution
Use the WHERE clause to specify which rows to keep. For example, to view all employees assigned to department number 10:
1 select *
2 from emp
3 where deptno = 10
Discussion
The WHERE clause allows you to retrieve only rows you are interested in. If the expression in the WHERE clause is true for any row, then that row is returned.
Most vendors support common operators such as: =, <, >, <=, >=, !, <>. Additionally, you may want rows that satisfy multiple conditions; this can be done by specifying AND, OR, and parenthesis .