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_dateovernightin 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
U.S. Flights dataset: the first 6 rows of each table. Under each column name: the kind of value it holds, and which table it links to. Your queries run on all rows.
overnight_sample4 columns · 2 rows
| flight_id | flight_datedate | scheduled_departuredate & time | scheduled_arrivaldate & time |
|---|---|---|---|
| 19600 | 2025-01-15 | 2025-01-15 22:49 | 2025-01-15 23:59 |
| 19616 | 2025-01-15 | 2025-01-15 23:30 | 2025-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
SELECT flight_id, flight_date, date(scheduled_arrival) AS arrival_date, date(scheduled_arrival) > flight_date AS overnight FROM overnight_sample ORDER BY flight_id
SELECT flight_id, flight_date, date(scheduled_arrival) AS arrival_date, date(scheduled_arrival) > flight_date AS overnight FROM overnight_sample ORDER BY flight_id
Look at the sample tables and SQL. Enter the rows you think the query returns, in this column order: flight_id, flight_date, arrival_date, overnight. Put each row in square brackets, then wrap all rows in another pair of brackets (JSON format). For example, [[1,null,null,null]] is one row with 4 values. Replace these with your predicted values. Use numbers without quotes, text in double quotes, and null for SQL NULL. Keep repeated rows. Use [] for no rows. Keep rows in the order specified by ORDER BY.
Hints and the answer are always available. Using them counts the question as solved with help.