Recipe 1.2. Retrieving a Subset of Rows from a TableProblemYou have a table and want to see only rows that satisfy a specific condition. SolutionUse 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 DiscussionThe 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, as shown in the next recipe. |