Tuesday, 10 April 2012

UNION Operator practice questions

Display the deptno, job of the employees working in 10th and 20 th departments.
SELECT Deptno,job FROM emp WHERE deptno = 10
UNION
SELECT Deptno,job FROM emp WHERE deptno = 20;

Write a query to display the 10th and 30th departments employee names with their numbers in order with ename.
SELECT Empno, Ename FROM emp WHERE deptno = 10
UNION
SELECT Empno, Ename FROM emp WHERE deptno = 30 
ORDER BY 2

Click on for interview questions

No comments:

Post a Comment

Do you want to comment