Question: Show names for all employees who have certificates on both Boeing 737-800 and Airbus A340-300.
Schema: create table employee (name varchar, eid varchar, PRIMARY KEY (name)); create table certificate (eid varchar, aid varchar, PRIMARY KEY (eid)); create table aircraft (aid varchar, name varchar, PRIMARY KEY (aid))
SQL: select t1.name from employee as t1 join certificate as t2 on t1.eid = t2.eid join aircraft as t3 on t3.aid = t2.aid where t3.name = "boeing 737-800" intersect select t1.name from employee as t1 join certificate as t2 on t1.eid = t2.eid join aircraft as t3 on t3.aid = t2.aid where t3.name = "airbus a340-300"