Now create and run SQL query that displays only JOB_DESCRIPTION and the Number o
ID: 3806359 • Letter: N
Question
Now create and run SQL query that displays only JOB_DESCRIPTION and the Number of employees in each job description sorted by JOB_DESCRIPTION. See the picture below to know the expected result. Note to accomplish this you will need to join EMP_1 with JOB by JOB_CODE but only select JOB_DESCRIPTION and you will need to use GROUP BY to get a count of how many employees have each JOB_CODE/JOB_DESCRIPTION. You will also need to use ORDER BY to sort the records by JOB_DESCRIPTION. For this problem, you need to provide your MySQL code as plain text inserted into the homework and the resulting table pasted as an image into your homework document.
MariaDB [jcherian3879] SELECT FROM EMP 1 EMP NUM I EMP LNAME I EMP FNAME I EMP INTIAL I EMP HIRE DATE I JOB CODE I 101 John I 2000-11-08 502 News I Senior I David 102 1989-07-12 501 I 1996-12-01 I 500 103 I Arbough June 1987-11-15 501 104 I Ramoras Anne Alice 105 I Johnson 1993-02-01 502 I Smithfield I William I 106 2004-06-22 500 107 I Alonzo 1993-10-10 500 Maria I Washington I Ralph 108 I 1991-08-22 501 I Smith 109 I 1997-01-18 501 Larry 9 rows in set (0.00 sec) MariaDB ijcherian3879] SELECT FROM JOB; I JOB CODE I JOB DESCRIPTION JOB CHG HOUR I JOB LAST UPDATE I 500 Programmer 35.75 I 2013-11-20 501 Systems Analyst 96.75 I 2013-11-20 I Database Designer 502 125.00 2014-03-24 I Electrical Engineer I 503 84.50 2013-11-20 I Mechanical Engineer I 504 67.90 I 2013-11-20 I Civil Engineer 505 55.78 2013-11-20 I Clerical Support 506 26.87 2013-11-20 DSS Analyst 507 45.95 I 2013-11-20 Applications Designer l 508 48.10 2014-03-24 Bio Technician 509 34.55 I 2013-11-20 18.36 I 2013-11-20 510 I General Support 11 rows in set (0.01 sec)Explanation / Answer
select J.JOB_DESCRIPTION, count(*) as NUM_EMPLOYEES
from JOB J
inner join EMP_1 E on EMP_1.JOB_CODE = E.JOB_CODE
group by E.JOB_DESCRIPTION order by JOB_DESCRIPTION;
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.