ScienceQtech Employee Performance Mapping
ScienceQtech Employee Performance Mapping
3A.
4B.
greater than four
4C.
between two and four
SELECT CONCAT(FIRST_NAME,'',LAST_NAME) AS
6.Write a query to list only those employees who have someone reporting to them. Also, show
the number of reporters (including the President).
6A.
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
ON m.EMP_ID = e.MANAGER_ID
GROUP BY m.EMP_ID
ORDER BY m.EMP_ID;
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.
7A.
UNION
SELECT
m.EMP_ID,m.FIRST_NAME,m.LAST_NAME,m.ROLE,m.DEPT,m.EMP_RATING,max(m.EMP_
RATING)
OVER(PARTITION BY m.DEPT)
AS "MAX_DEPT_RATING"
FROM emp_record_table m
ORDER BY DEPT;
9.Write a query to calculate the minimum and the maximum salary of the employees in each role.
Take data from the employee record table.
9A.
FROM emp_record_table
10.Write a query to assign ranks to each employee based on their experience. Take data from
the employee record table.
10A.
SELECT EMP_ID,FIRST_NAME,LAST_NAME,EXP,
SELECT EMP_ID,FIRST_NAME,LAST_NAME,COUNTRY,SALARY
FROM emp_record_table
WHERE SALARY>6000;
12.Write a nested query to find employees with experience of more than ten years. Take data
from the employee record table.
12A.
DELIMITER &&
BEGIN
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.
The standard being:
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',
For an employee with the experience of 12 to 16 years assign 'MANAGER'.
14A.
DELIMITER &&
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.
15A.
ON emp_record_table(FIRST_NAME(20));
SELECT EMP_ID,FIRST_NAME,LAST_NAME,SALARY,COUNTRY,CONTINENT,
AVG(salary)OVER(PARTITION BY COUNTRY)AVG_salary_IN_COUNTRY,
AVG(salary)OVER(PARTITION BY CONTINENT)AVG_salary_IN_CONTINENT,
COUNT(*)OVER(PARTITION BY COUNTRY)COUNT_IN_COUNTRY,
COUNT(*)OVER(PARTITION BY CONTINENT)COUNT_IN_CONTINENT
FROM emp_record_table;