Correlated Subqueries


#1

Can someone walk me through what the bold portion of the below script is doing or what it’s purpose is?

SELECT carrier, id,
(SELECT COUNT(*)
FROM flights f
WHERE f.id < flights.id
AND f.carrier=flights.carrier) + 1
** AS flight_sequence_number**
FROM flights;


#2

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.