I have this question:
Name and number of flight hours of co-pilots who have flown the most flights. It is intended to know the exact number of flights made by each of these co-pilots
And I tried to solve it like this:
SELECT t.nome , p1.n_horas_voo , COUNT( * ) as n_de_voos
FROM Tripulante t , Piloto p1 , Voo v
WHERE t.id = v.id_copiloto
AND v.id_copiloto = p1.id
GROUP BY ( t.apelido )
HAVING COUNT( * ) >= ALL( SELECT COUNT(*)
FROM Voo v2)
However, my output is this
anditshouldbejustCarlosbecauseheistheco-pilotwhomademoreflights.WhatamIdoingwrong?OrhowdoIsolvethisquestion?
Tables: