Subscribe:

Sunday, October 2, 2011

RULES OF PRIORITY


IN SQL SELECT statement the oracle server evaluates comparison operator’s begor logival operators.
In the evaluation of logical operators ,NOT is evaluated first,AND is evaluated second,and OR
Is evaluated third.
You can override rules of precedence by using parentheses.
For example
Select empno,ename,job
From  emp
Where  SAL =1500
AND (JOB  =’SALESMAN’
OR  job  =’CLERK’);

    EMPNO ENAME      JOB
--------- ---------- ---------
     7844 TURNER     SALESMAN
The result lists employees who are either a CLERK or a SALESMAN and who earn more than $1500.

No comments:

Post a Comment