Draw the Query Tree for the following queries. 1- Display the employee names, th
ID: 3809521 • Letter: D
Question
Draw the Query Tree for the following queries.
1- Display the employee names, their manager’s name and the department names for all the employees whose department is located in ‘DALLAS’.
2- Display the number of job-tiles in each department arranged in ascending order of the job-tiles [Hint: You have to use DISTINCT, GROUP BY and ORDER BY].
COMM DEI INO JOB IMGR REDATE ESAL COMM DEPTNO EMPNO ENAME 17Dec80 600 7499 ALLEN SALESMAN 7698 20 Feb 81 1600 300 301 ARD SALESMAN 7521 7698 22 Feb-81 1250 500 30 78 02 Apr-81 2315 20 MANAGER 7566 JONES MARTIN SALESMAN 7626 26.sep-81 1250 1400 30 7654 7638 BLAKE MANAGER 7839 01-May 81 2850 7782 CLARK MANAGER ogNun-81 2450 101 7839 ANALYST 75661 09 Dec 82 3000 200 17 Now81 5000 SALESMAN Sep-01 1500 0 7788 SCOTT 7839 KING 7014 TURNER 12 Jan-83 1100 CLERK 76981 03 Dec81 950 30 7900 JAMES 7902 FORD ANALYST 7566 03 Dec81 3000 20 7934 MILLER CLERK 23Jan-82 1300 DEPT DEPTNO DNAME LOC) LOC DEPTNO ENAME LOC DEPTNO DNAME 10 ACCOUNTING NEW YORK 20 RESEARCH DALLAS CHICAGO 30 SALES 40 OPERATIONS BOSTONExplanation / Answer
Answer 1
select E.ENAME, E.MGR, D.DNAME from EMP E join DEPT D on D.DEPTNO = E.DEPTNO where D.LOC = 'DALLAS';
Answer 2
select D.DNAME, distinct count(E.JOB) as NO_DEPT from EMP E join group by D.DEPTNO order by asc;
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.