What are the IDs of the aircrafts with name Airbus A340-300?
select distinct aid from aircraft where name = "Airbus a340-300"
Yes please.
select sum ( distance ) from flight where aid = ( select distinct aid from aircraft where name = "Airbus a340-300" )
WHat flight numbers have that aid?
select t1.flno from flight as t1 join aircraft as t2 on t1.aid = t2.aid where t2.name = "Airbus a340-300"