IN SQL PLEASE Management also has concerns about the salaries of younger employe
ID: 3891575 • Letter: I
Question
IN SQL PLEASE
Management also has concerns about the salaries of younger employees. Using a subquery approach, write a query to display the last and first names, department number, salary, and birth date of the youngest employee in each department. Hint: Use the MAX function.?
employee emp ssn emp_ last_mame emp first_name emp middle_name emp address emp city emp state emp emp_date_of birth emp salary emp_parking_space emp gender emp-apf number tworks Here caldpt-narne emp-Supersm Supervise Has Employee project assignment Works On swork emppro_number work_ pro_mumber work hous pro name pro_location pro_dept_number Controls Proj i Manage Dept department dept locations dpt_no H-- -- dpt_ao Locsted In dpt_location apt mgrssn dpt mgr_start_date dependent Primary Keys (PKs) boldfaced Foreign Keys (FKs) Ralicized FK that is also part of a PK = boldfaced and italicized dep_name Has Dependent dep_gender dep date of birth dep_relationshipExplanation / Answer
Answer)
Using subquery listing out the last and first names, department number, salary, and birth date of the youngest employee in each department. Using max function to find the youngest employee in each department.
select emp_last_name, emp_first_name, emp_dpt_number, emp_salary, emp_date_of_birth from employee where emp_date_of_birth in (
select max(emp_date_of_birth) from employee group by emp_dpt_number
);