Professional Documents
Culture Documents
SELECT deptno
FROM emp
UNION
SELECT DEPTNO
FROM dept
ORDER BY DEPTNO;
SELECT deptno,job
FROM emp
WHERE deptno > 10
UNION
SELECT deptno, dname
FROM DEPT
WHERE deptno> 20
ORDER BY 1;
/*interset example
INTERSECT
INTERSECT is opposite from MINUS as it returns us the results that are both to be
found in first and second SELECT statement.
*/
SELECT DEPTNO
FROM emp
intersect
SELECT DEPTNO
FROM dept
/*minus use in oracle example except used in sql server*/
SELECT DEPTNO
FROM DEPT
except
SELECT DEPTNO
FROM emp