CREATE TABLE certificate (eid DECIMAL, aid DECIMAL)
CREATE TABLE employee (eid DECIMAL, name TEXT, salary DECIMAL)
CREATE TABLE flight (flno DECIMAL, origin TEXT, destination TEXT, distance DECIMAL, departure_date TIME, arrival_date TIME, price DECIMAL, aid DECIMAL)
CREATE TABLE aircraft (aid DECIMAL, name TEXT, distance DECIMAL)

Show the name and distance of the aircrafts with more than 5000 distance and which at least 5 people 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
SELECT "T2"."name" FROM "certificate" AS "T1" JOIN "aircraft" AS "T2" ON "T1"."aid" = "T2"."aid" AND "T2"."distance" > 5000 GROUP BY "T1"."aid" ORDER BY COUNT(*) >= 5 NULLS FIRST