SUBQUERIES

Question

Q4.     Extract the information about all department managers who were hired between the 1st of      January 2020 and the 1st of January 2021.

 

DEPARTMENT MANAGER

Emp_id First_name Last_name Sex
1 Aman Rathore M
2 Gaurav Singh M
5 Goli Beta M
7  Natu Kaka M

 

 

EMPLOYEES

Emp_id Emp_name Hire_date
1 Aman 2021-06-27
2 Gaurav 2020-05-04
3 Rohit 2021-06-18
4 Vimal 2019-07-16
5 Goli 2019-08-09
6 Shivam 2018-09-10
7 Natu 2020-06-07
in progress 0
Aman rathore 3 years 1 Answer 873 views Member 0

Answer ( 1 )

  1. Ans.
    SELECT *
    FROM
    dept_manager
    WHERE
    Emp_no IN (SELECT
    Emp_no
    FROM
    employees
    WHERE
    Hire_date BETWEEN ‘2020-01-01’ AND ‘2021-01-01’);

Leave an answer

Browse
Browse