3.24

Using the university schema, write an SQL query to find the name and ID of those Accounting students advised by an instructor in the Physics department.


SELECT s.id, s.name
FROM student AS s INNER JOIN advisor AS a ON s.id = a.s_id
                  INNER JOIN instructor AS i ON a.i_id = i.id
WHERE s.dept_name = 'Accounting' AND i.dept_name = 'Physics';