runtime
104 / 139

task Monthly / weekly buckets · medium

Predict: dates across midnight

Predict the arrival date and whether it differs from the flight date for each sample flight.

what to return

Columns
flight_idflight_datearrival_dateovernight in this order
Rows
in the order asked
Watch for
Use only the sample rows shown. NULL is not zero or empty text. Keep duplicate rows.
Skill
Reason about the exact result of a fixed SQL query. Refresher: Date boundaries & monthly buckets →

data you can query

overnight_sample4 columns · 2 rows
flight_idflight_datedatescheduled_departuredate & timescheduled_arrivaldate & time
196002025-01-152025-01-15 22:492025-01-15 23:59
196162025-01-152025-01-15 23:302025-01-16 07:47
flight_id
19600
flight_datedate
2025-01-15
scheduled_departuredate & time
2025-01-15 22:49
scheduled_arrivaldate & time
2025-01-15 23:59
flight_id
19616
flight_datedate
2025-01-15
scheduled_departuredate & time
2025-01-15 23:30
scheduled_arrivaldate & time
2025-01-16 07:47

all 2 rows

predict.sql
SELECT
  flight_id,
  flight_date,
  substr(scheduled_arrival, 1, 10) AS arrival_date,
  substr(scheduled_arrival, 1, 10) > flight_date AS overnight
FROM overnight_sample
ORDER BY flight_id
prediction.json

Enter the rows you think the query returns, column order flight_id, flight_date, arrival_date, overnight. JSON array of rows — numbers bare, text in quotes, null for NULL. Example: [ [ 1, null, null, null ] ]. Keep ORDER BY order.

 
Output

Hints and the answer are always available. Using them counts the question as solved with help.

Predict: dates across midnight — SQL practice · Runtime