Challenge
Retirement Analysis of Pewlett Hackard
Overview
In this analysis we made a series of queries to our database to obtain key information about the employees that are soon to retire from Pewlett Hackard.
Our database contains a few tables with many relations to the employee id. This is our database diagram:
Results
1.- All current employees that are nearing retirement, which means all those who were born between 1962 and 1965 and are currently employeed in the company.
SELECT * FROM retirement_titles
LIMIT 3;
emp_nofirst_namelast_nametitlefrom_dateto_date10001GeorgiFacelloSenior Engineer1986-06-269999-01-0110004ChirstianKoblickEngineer1986-12-011995-12-0110004ChirstianKoblickSenior Engineer1995-12-019999-01-01
2.- We filtered the previous result to make sure that we only get the latest title of each employee that is nearing retirement, that means that it is their current title.
SELECT * FROM unique_titles
LIMIT 3;
emp_nofirst_namelast_nametitlefrom_dateto_date10001GeorgiFacelloSenior Engineer1986-06-269999-01-0110004ChirstianKoblickSenior Engineer1995-12-019999-01-0110005KyoichiMaliniakSenior Staff1996-09-129999-01-01
3.- We can then count how many employees per title are retiring.
SELECT * FROM retiring_titles
LIMIT 3;
titleEmployee CountSenior Engineer25916Senior Staff24926Engineer9285
4.- Finally, we will look for all current employees that can qualify for the mentorship program, which means that is all those born in 1965.
SELECT * FROM mentorship_eligibilty
LIMIT 3;
emp_nofirst_namelast_namebirth_datefrom_dateto_datetitle10095HilariMorton1965-01-031994-03-109999-01-01Senior Staff10122OhadEsposito1965-01-191998-08-069999-01-01Technique Leader10291DipayanSeghrouchni1965-01-231987-03-309999-01-01Senior Staff
Summary
We can count the number of employees that are leaving the company by summing the rows in our retiring_titles table.
SELECT SUM("Employee Count")
FROM retiring_titles;
sum72458
That means we will need to fill 72,458 positions in the company once those employees retire.
We want to check if there are enough employees that qualify for the mentorship program. So we can get the sum from our other table.
SELECT COUNT(emp_no)
FROM mentorship_eligibilty;
count1549
There are only 1,549 employees in the mentorship program. Which seems like a low number of employees, so we may need to invest further in training of the next generation of Pewlett Hackard employees once the 52-55 generation retires.
Closing Thoughts
SQL queries are a very powerful way to get information of the data in our database without needing big transformations or processing. The most powerful feature is probably the relations between the different tables, as you can construct fairly complex and powerful queries to fetch any arrangement of data you want.