can we write the query like this:
SELECT *
FROM employees e
WHERE (e.hire_date BETWEEN '1990-01-01' AND '1995-01-01' )
AND e.emp_no IN( SELECT dm.dept_no FROM dept_manager dm);
3 answers ( 0 marked as helpful)
It executed without errors but it didn't return any row?
Hi Ekaterina!
Thanks for reaching out.
The query is correct in terms of syntax but as Yumma said it returns 0 rows. Please, stick to the provided solution as this method does not work.
Hope this helps.
Best,
Tsvetelin
Your query did not return any row because you do not link the two tables. You used "e.emp_no" before the "in" and "dm.dept_no" after the select in the subquery.
If you change the "dm.dept_no" to "dm.emp_no" in the subquery, your query should be fine.