Between, In Operators in SQL

This lesson will describe the usage of IN, Between Operators in Oracle

At times usage of OR, AND becomes cumbersome. Oracle has facilitated some other operators

BETWEEN

SELECT ENAME,JOB,SAL FROM EMP

WHERE SAL BETWEEN 1500 AND 3000;

is exactly equivalent to

SELECT ENAME,JOB,SAL FROM EMP

WHERE SAL> 1500 AND SAL < 3000;

Between can replace complicated AND operators

IN

SELECT EMPNO,ENAME,JOB,DEPTNO FROM EMP

WHERE JOB IN (‘PRESIDENT’,’MANAGER’,’ANALYST’);
 

This is exactly equivalent to

SELECT EMPNO,ENAME,JOB,DEPTNO FROM EMP

WHERE JOB =‘PRESIDENT’ OR JO’MANAGER’,’ANALYST’;

IN can replace complicated OR operators

Leave a Reply