Instructions:
Write a query to view flights by origin, flight id, and sequence number. Alias the sequence number column as flight_sequence_number.
Sample Solution:
SELECT origin, id,
(SELECT COUNT(*)
FROM flights f
WHERE f.id < flights.id
AND f.origin=flights.origin) + 1
AS flight_sequence_number
FROM flights;
No comments:
Post a Comment