Last answered:

21 Nov 2022

Posted on:

16 Nov 2022

0

Don't know if this answer is right

Can someone tell me if this answer is correct?

SELECT
    e.hire_date, e.first_name
FROM
    employees e
WHERE
    e.emp_no IN (SELECT
            dm.emp_no
        FROM
            dept_manager dm)
HAVING
e.hire_date BETWEEN "1990-01-01" AND "1995-01-01"

The solution:
image.png

| | |
| | |

2 answers ( 0 marked as helpful)
Posted on:

17 Nov 2022

0

It is not the right answer since you didn't retrieve what the question wants : "Information about all department managers who .."
your outer select statement should be from dept_manager table, and your inner select statement from employees which contains 'hire_date' that is the key to filter all employees.

Instructor
Posted on:

21 Nov 2022

0

Hi Maged!
Thanks for reaching out.

Yes, this is also a valid solution. You used other tables but the result set is correct. You can check with the following query:
SELECT
    *
FROM
    employees
WHERE
    emp_no IN (110420 , 111877);

You will obtain the same employees: Oscar and Xiaobin.



Hope this helps.
Best,
Tsvetelin

Submit an answer