Question
The Employee table consists of the following data fields: Employee ID, Employee Name, Employee Department, Employee Manager (EMP_ID of the Employee to whom the employee
The Employee table consists of the following data fields: Employee ID, Employee Name, Employee Department, Employee Manager (EMP_ID of the Employee to whom the employee reports) and Employee DOH (Date of Hire). Using the following data table, answer the questions with appropriate SQL queries.
EMP_ID | EMP_NAME | EMP_DEPT | EMP_MANAGER | EMP_DOH |
1 | John | IT | 9 | 05-08-2010 |
2 | Alex | Finance | 0 | 06-03-2008 |
3 | Linda | IT | 9 | 07-02-2010 |
4 | Robin | Purchase | 8 | 08-12-2010 |
5 | Maki | Purchase | 8 | 09-08-2012 |
6 | Ross | Sales | 7 | 10-05-2012 |
7 | Reiki | Sales | 2 | 11-02-2009 |
8 | Anna | Sales | 2 | 12-08-2011 |
9 | Jena | IT | 2 | 01-01-2008 |
10 | Bonny | IT | 9 | 01-01-2008 |
1. List the employees who are not managers (i.e. have no one reporting to them).
2. List the Managers having only one reportee.
3. In which month were the most employees hired?
4. What is the experience gap between the first employee and the latest?
5. Find the manager with the most reportees.
6. List managers who joined after all their reportees.
7. Which department has the most managers, and how many?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started