What are the ids of all instructors who are advisors?
select i_id from advisor as t1 join student as t2 on t1.s_id = t2.id
Of these, which advise students in the History department?
select i_id from advisor as t1 join student as t2 on t1.s_id = t2.id where t2.dept_name = 'History'