Skip to main content

Employee Hierarchy

Hard

You have been hired by company XYZ as a Data Analyst. The management has provided you with the employee data and salary information listed below. You have been asked to draw a few key conclusions from the data.

Table 1: tbl_Employee

Emp_IDFirst_NameMiddle_NameLast_NameManager_IDDate_Of_JoiningCountry
1TimSheaMurray1001-01-2000Ireland
2PaulDavidDesmond1130-01-2021Ireland
3JamesDonaldObrien1204-03-1998India
--------------

Table 2: tbl_EmployeeSalary

Emp_IDProjectSalaryDesignation
1Proj_12000Project Manager
2Proj_22333Senior Software Developer

A new employee named Paul Desmond whose emp_id is 2 has joined the organization as a senior software engineer. The management wants to look at his reporting hierarchy up to level 3 and the salary difference between him and the reporting manager at that level. Print the full names of all reporting managers, as well as the salary differences as mentioned below. The salary amount shown in the table tbl EmployeeSalary is in the country's local currency. To keep things simple, all salaries should be converted to US dollars before calculating and presenting the results.

Note: To convert Irish currency to dollars, multiply the salary by 1.09 whereas for Indian currency, multiply by 0.012.

Desired Output:

Reporting Manager NameLevelSalary Difference
James O Brien12000
Tom O Mahony23000
Mark Forde33000