0
我有一个小问题。我正在学习数据库考试,因此我无法真正测试问题中提出的查询。假设我们有这些表:SQL查询问题
PlaneModel = {id, number_seats}
Pilot = {id, name, telephone, birth_date}
Plane = {id, name, model}
Flight = {id, date, id_Plane, id_Pilot, duration, origin, destiny}
的运动是:建立一个查询,将显示由现有的所有飞行员驾驶飞机。
我来什么事到是这样的:
select p.id from Plane p, Pilot pi, Flight f
where f.id = pi.id_Pilot and f.id_Plane = p.id
group by p.id
having f.id_Pilot in all (select id from Pilot);
但我不很确定,如果这个工程,因为我无法测试它。这样对吗?如果不是,你建议什么?
我建议您使用适当的'join'语法。如果你的导师没有教导,那么采取更好的方法。 –
在计算机上安装RDBMS以测试您的想法与 – suspectus
真的很有用您可以在www.sqlfiddle.com上测试。 –