Thursday, September 17, 2009

Using Logical Conditions in SQL Statement

Logical Conditions :



Operator Meaning
  • OR Returns TRUE if either component condition is true
  • AND Returns TRUE if both component conditions are true
  • NOT Returns TRUE if the following condition is false
Using the AND Operator :
  • AND requires both conditions to be true
  • SELECT empno, ename, sal FROM emp WHERE sal >=1000 AND job LIKE '%MAN%' ;
Using the OR Operator :
  • OR requires any condition to be true
  • SELECT empno, ename, sal FROM emp WHERE sal >=1000 OR job LIKE '%MAN%' ;
Using the NOT Operator :
  • SELECT empno, ename, job FROM emp WHERE sal >=1000 AND job NOT IN (‘CLERK’,’SALESMAN’) ;

No comments:

Post a Comment

Followers