Given a table of flight departures, write a query using window functions (LEAD or LAG) to find the time difference between consecutive departures from the same airport.
Use the provided flight_departures table. Ignore rows with a NULL airport code or departure time, and exclude each airport's final departure because it has no following departure.
airport_code, departure_id, departure_time, next_departure_time, and minutes_to_next| Column | Type | Description |
|---|---|---|
| departure_idPK | INTEGER | Unique identifier for the departure |
| airport_code | VARCHAR(3) | Three-letter airport code |
| departure_time | TIMESTAMP | Scheduled departure timestamp |