What are the distinct names of all the students?
select distinct name from student
Of these, which took classes in 2009 or 2010?
select distinct t1.name from student as t1 join takes as t2 on t1.id = t2.id where year = 2009 or year = 2010