Logical Operators
Rules of Precedence:
Order evaluated
|
Operator
|
1
|
All comparison operators
|
Example: To produce those records of salesman or president who are having salary above 15000/-
Select ename, job, sal from emp
Where job = 'SALESMAN' or job = 'PRESIDENT'
And sal>15000;
The query formulation as above is wrong for the problem statement. The correct formulation would be:
SELECT ENAME, JOB, SAL FROM EMP
WHERE (JOB = 'SALESMAN' OR JOB = 'PRESIDENT') AND SAL>15000;