What are the names and distances of aircraft that have more than 5000 distance?
select t2.name from certificate as t1 join aircraft as t2 on t2.aid = t1.aid where t2.distance > 5000
What are the names and distances of aircraft that have more than 5000 distance and there are at least 5 people who have its certificate?
select t2.name from certificate as t1 join aircraft as t2 on t2.aid = t1.aid where t2.distance > 5000 group by t1.aid order by count ( * ) > = 5
What is the employee ID of the employee who flew the longest distance?
select t1.eid from certificate as t1 join aircraft as t2 on t2.aid = t1.aid order by t2.distance desc limit 1