Monday, November 18, 2019

Oracle: IN, NOT IN, BETWEEN, NOT BETWEEN, Range Searching Query:

1. SELECT ENAME, SAL FROM EMP
WHERE  SAL  NOT BETWEEN 1000 AND 3500;

2. SELECT ENAME, SAL FROM EMP
WHERE  SAL NOT  IN(1000,3500,1100,1500);

3. SELECT ENAME, SAL FROM EMP
WHERE  SAL NOT  IN(1000,3500,1100,1500)
ORDER BY ENAME, SAL ASC;

4. SELECT ENAME, SAL FROM EMP
WHERE  SAL NOT  IN(1000,3500,1100,1500)
ORDER BY ENAME DESC;

5. SELECT ENAME, SAL FROM EMP
   WHERE  sal  > 3000
   AND  sal  < 4000;

6. SELECT ENAME, SAL FROM EMP
WHERE  sal  > 3000  OR sal  < 4000;

7. SELECT ENAME, SAL FROM EMP
WHERE  SAL BETWEEN 1000 AND 3500;

8. SELECT ENAME, SAL FROM EMP
WHERE  SAL  IN(1000,3500,1100,1500);



No comments:

Post a Comment

Financial Year Oracle PLSQL Program

 CREATE OR REPLACE function FINANCIAL_YEAR(p_date DATE) return varchar2 IS    v_first     varchar2(4);    v_second    varchar2(4);    v_year...