Project
Project
ScienceQtech
Employee Performance Mapping
By:
Sonukumar Rameschandra Jaiswar
BA - SQL
[email protected]
Description
ScienceQtech is a startup that works in the Data Science field. ScienceQtech has worked on fraud
detection, market basket, self-driving cars, supply chain, algorithmic early detection of lung cancer,
customer sentiment, and the drug discovery field. With the annual appraisal cycle around the corner, the
HR department has asked you (Junior Database Administrator) to generate reports on employee details,
their performance, and on the project that the employees have undertaken, to analyze the employee
database and extract specific data based on different requirements.
Objective:
To facilitate a better understanding, managers have provided ratings for each employee which will help
the HR department to finalize the employee performance mapping. As a DBA, you should find the
maximum salary of the employees and ensure that all jobs are meeting the organization's profile
standard. You also need to calculate bonuses to find extra cost for expenses. This will raise the overall
performance of the organization by ensuring that all required employees receive training.
***The task
6. Write a query to list only those employees who have someone reporting to them. Also, show the
number of reporters (including the President).
SELECT m.EMP_ID,m.FIRST_NAME,m.LAST_NAME,m.ROLE,
m.EXP,COUNT(e.EMP_ID) as "EMP_COUNT"
FROM emp_record_table m
INNER JOIN emp_record_table e
ON m.EMP_ID = e.MANAGER_ID
GROUP BY m.EMP_ID
ORDER BY m.EMP_ID;
SELECT @@sql_mode;
7. Write a query to list down all the employees from the healthcare and finance departments using
union. Take data from the employee record table.
10. Write a query to assign ranks to each employee based on their experience. Take data from the
employee record table.
DELIMITER &&
CREATE PROCEDURE get_experience_details()
BEGIN
SELECT EMP_ID,FIRST_NAME,LAST_NAME,EXP FROM emp_record_table WHERE EXP>3;
END &&
CALL get_experience_details();
14. Write a query using stored functions in the project table to check whether the job profile
assigned to each employee in the data science team matches the organization’s set standard.
For an employee with experience less than or equal to 2 years assign 'JUNIOR DATA SCIENTIST',
For an employee with the experience of 2 to 5 years assign 'ASSOCIATE DATA SCIENTIST',
For an employee with the experience of 5 to 10 years assign 'SENIOR DATA SCIENTIST',
For an employee with the experience of 10 to 12 years assign 'LEAD DATA SCIENTIST',
EXP int
RETURNS VARCHAR(40)
DETERMINISTIC
BEGIN
SET Employee_ROLE="MANAGER";
END IF;
RETURN (Employee_ROLE);
END &&
SELECT EXP,Employee_ROLE(EXP)
FROM data_science_team;
15. Create an index to improve the cost and performance of the query to find the employee whose
FIRST_NAME is ‘Eric’ in the employee table after checking the execution plan.
16. Write a query to calculate the bonus for all the employees, based on their ratings and salaries
(Use the formula: 5% of salary * employee rating).
update emp_record_table set salary=(select salary +(select salary*.05*EMP_RATING))
SELECT *FROM emp_record_table;
17. Write a query to calculate the average salary distribution based on the continent and country.
Take data from the employee record table.