Monday, November 18, 2019

Oracle: UNION, MINUS, INTERSECTION

1. SELECT ename,sal,comm FROM emp
   where ename like 'A%'
   UNION
   SELECT ename,sal,comm FROM emp
   where ename like 'E%'


2. SELECT ename,sal,comm FROM emp
   where ename like 'A%'
   UNION ALL
   SELECT ename,sal,comm FROM emp
   where ename like 'A%'


3. SELECT ename,sal,comm FROM emp
   where ename like 'E%'
   MINUS
   SELECT ename,sal,comm FROM emp
   where ename like 'E%'
   AND Comm IS NULL


4. SELECT ename,sal,comm FROM emp
   where ename like 'A%'
   INTERSECTION
   SELECT ename,sal,comm FROM emp
   where ename like 'A%'
   and sal < 2000

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...