Last answered:

01 Dec 2021

Posted on:

18 Nov 2021

0

Assignment: JOIN more than two tables in SQL

My query differs from what was provided as the solution.
SELECT e.first_name, e.last_name, e.hire_date, t.title, dm.from_date, d.dept_name
FROM employees e
                JOIN
            titles t ON e.emp_no = t.emp_no
                JOIN
            dept_manager dm ON t.from_date = dm.from_date
                JOIN
            departments d ON dm.dept_no = d.dept_no
WHERE t.title = 'Manager'
ORDER BY e.emp_no;

Can I be offered clarification on what i did wrong?

1 answers ( 0 marked as helpful)
Instructor
Posted on:

01 Dec 2021

0

Hi Esther!

Thanks for reaching out!

The difference is that you used another condition for the ON clause. Please, use the condition provided in the solution as it refers to tables that have been linked through the relevant PK and FK constraints. We have checked these constraints prior to joining these tables.

Hope this helps.
Best,
Martin

Submit an answer