Sorting passengers by the number of flights
Display the identifier, name, and number of flights for each passenger who has made at least one flight. The result should be sorted by the number of flights (descending) and by name (ascending).
Use the "as count" construct for the aggregate function counting the number of flights. This is necessary for correct verification.
Fields in the resulting table:
id, name, count
Code from the script:
SELECT Passenger.name AS name, COUNT(Pass_in_trip.id) AS count
FROM Passenger
JOIN Pass_in_trip ON Passenger.id = Pass_in_trip.passenger
GROUP BY Passenger.name
ORDER BY count DESC, name ASC;