runtime
138 / 139

task Date filtering · easy

Predict: which trips are in January?

Predict both flags for each sample trip around midnight on 31 January.

what to return

Columns
trip_idpickup_atin_betweenin_half_open 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

midnight_sample2 columns · 8 rows
trip_idpickup_atdate & time
384602025-01-30 23:56:52
384612025-01-30 23:59:34
384622025-01-31 00:00:13
384632025-01-31 00:01:57
400112025-01-31 23:58:29
400122025-01-31 23:58:43
400132025-02-01 00:01:07
400142025-02-01 00:01:09
trip_id
38460
pickup_atdate & time
2025-01-30 23:56:52
trip_id
38461
pickup_atdate & time
2025-01-30 23:59:34
trip_id
38462
pickup_atdate & time
2025-01-31 00:00:13
trip_id
38463
pickup_atdate & time
2025-01-31 00:01:57
trip_id
40011
pickup_atdate & time
2025-01-31 23:58:29
trip_id
40012
pickup_atdate & time
2025-01-31 23:58:43
trip_id
40013
pickup_atdate & time
2025-02-01 00:01:07
trip_id
40014
pickup_atdate & time
2025-02-01 00:01:09

all 8 rows

predict.sql
SELECT
  trip_id,
  pickup_at,
  pickup_at BETWEEN '2025-01-01' AND '2025-01-31' AS in_between,
  (pickup_at >= '2025-01-01' AND pickup_at < '2025-02-01') AS in_half_open
FROM midnight_sample
ORDER BY pickup_at, trip_id
prediction.json

Enter the rows you think the query returns, column order trip_id, pickup_at, in_between, in_half_open. 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: which trips are in January? — SQL practice · Runtime