-3
I have this question:
Name and number of flight hours of the copilot who made the largest number of flights. It is intended to know the exact number of flights made by each of these copilot
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
and it should just be Carlos because he is the co-pilot who made the most flights. What am I doing wrong? Or how do I solve this question?
Tables:
What is the database?
– Ricardo
From what I saw two answers came out in the question that would solve the problem or at least refer to a solution. There you said that you cannot use subquery without explaining the reason. You also already have other questions similar to yours on the site, with the same problem of lack of clarity. I think it is the case that you read the [Tour] and [Ask], and [Dit] the question elaborating better and explaining all the necessary conditions beforehand, because by your comments, I understand that the question Is Not Clear enough for people to answer what you expect.
– Bacco
Working out better, everyone wins because it increases the chance of some answer coming out that solves your problem, and prevents people from wasting time answering something that will not serve for reasons that were not put in the question.
– Bacco