Mr. Som, a HR Manager in a multinational company “Star-X world” has created the following table to store the records of employees:
Mr. Som, a HR Manager in a multinational company “Star-X world” has created the following table to store the records of employees:
Table: Emp
| Eid | EName | Department | DOB | DOJ |
| Star1 | Ivan | Sales | 1994-08-28 | 2020-02-14 |
| Star2 | Melinda | IT | 1997-10-15 | 2021-11-19 |
| Star3 | Raj | Accounts | 1998-10-02 | 2019-04-02 |
| Star4 | Michael | Sales | 2000-02-17 | 2020-05-01 |
| Star5 | Sajal | IT | 2001-12-05 | 2018-06-13 |
| Star6 | John | Accounts | 1995-01-03 | 2019-07-15 |
| Star7 | Julia | Sales | 1985-11-13 | 2020-08-19 |
He has written following queries:
i) select max(year(DOB)) from emp;
ii) select ENAME from emp where month(DOJ)=11;
Predict the output.
OR
Based on the table given above, help Mr. Som writing queries for the following task:
i) To display the name of eldest employee and his/her date of birth.
ii) To display the name of those employees whose joining month is May.
2 Answers
Mr. Som, a HR Manager in a multinational company “Star-X world” has created the following table to store the records of employees: Table: Emp
| Eid | EName | Department | DOB | DOJ |
| Star1 | Ivan | Sales | 1994-08-28 | 2020-02-14 |
| Star2 | Melinda | IT | 1997-10-15 | 2021-11-19 |
| Star3 | Raj | Accounts | 1998-10-02 | 2019-04-02 |
| Star4 | Michael | Sales | 2000-02-17 | 2020-05-01 |
| Star5 | Sajal | IT | 2001-12-05 | 2018-06-13 |
| Star6 | John | Accounts | 1995-01-03 | 2019-07-15 |
| Star7 | Julia | Sales | 1985-11-13 | 2020-08-19 |
Output:
i) 2001
ii) Melinda
OR
Queries:
i) select ENAME,min(year(DOB)) from emp;
ii) select ENAME from emp where month(DOJ)=5;