Note: These are not homework problems. I am studying dbms on my own, hence these homework-like questions.
Two tables :
Teachers (teacher_id, teacher_name)
Courses (teacher_id,course_id, course_name)
In order to select teacher names who are not teaching any courses, there are two queries I can think of :
mysql> explain select teacher_name from teachers left join courses on (teachers.
teacher_id = courses.teacher_id) where course_id is null;
mysql> explain select teacher_name from teachers where teacher_id not in (select
teacher_id from courses);
Which one will be more efficient? Why?