FROM flights f
WHERE f.id < flights.id
AND f.origin = flights.origin) + 1 AS fsn
I thought I'd chime in with what I think is going on with the code. That's the actual answer for the question. Basically, you want to return the columns Origin, ID and FSN (flight sequence number). The first two are self-explanatory. For the FSN, you are essentially counting the total number of flights that have the same origin and when there is more than one, you are adding 1 to the FSN for the flight ID that is lower. So, the origin ABQ has only one flight that originates from there, and that one flight has 1 for its FSN. If there was more than one, the the flight that has the lower flight ID would have an FSN of 2. To see this for yourself, just add
ORDER BY origin;
at the end of the code, and you will be able to see that the origins that have more than one flight will have an FSN that increases by 1 for each flight ID that is lower.
Hope that helps!