I have a different answer than 365 data solution when I this code
ELECT
e.first_name,
e.last_name,
e.hire_date,
dm.dept_no,
d.dept_name,
titles.title
FROM
dept_manager dm
JOIN
employees e ON dm.emp_no = e.emp_no
JOIN
departments d ON dm.dept_no = dm.dept_no
JOIN
titles ON e.emp_no = titles.emp_no
where titles.title='manager';
it back with 216 row while when yours is back only with 24 rows
I also noticed that same employee can work in different departments
Hi Islam!
Thanks for reaching out.
Please excuse me for the belated answer.
There are many differences between the query you've executed and the one we discuss in the lecture.
Among the differences, there are:
- you have included the "titles" data table into the equation (i.e. you have referred to the data contained in it)
- you have matched the department number column from the 'department manager' table twice, as you opposed to matching this column with the column bearing the same name from the 'departments' table.
Please remove them from your query and you should be able to obtain an answer containing 24 rows.
Hope this helps.
Kind regards,
Martin
your inner join with department table has a typo. you need to join on key "dm.dep_no" and "d.dept_no"
have highlighted the changes you need to make to your query in BOLD
departments d ON dm.dept_no = d.dept_no