I cannot understand the intention behind the ‘+1’ in the code and the whole idea behind this exercise. What is the purpose of the flight sequence number?
SELECT origin, id,
FROM flights f
WHERE f.id < flights.id
AND f.origin=flights.origin) + 1