AND is an ADDITIONAL rule. You can also use OR to mark 'either' type rules. OR is more tricky to get right, so it is best to put OR rules in round brackets. For instance, to find salaries less than 20000, or salaries greater than 30000, but only where the enddate is null, try
SELECT empno,salary
FROM jobhistory
WHERE ( salary < 20000 OR salary > 30000 )
AND enddate IS NULL;
Try listing empnos from employee where the empno is less than 5 or greater than 20.
|