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

Mobility 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.

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

first 6 of 8 rows · your queries use all of them

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
Read the query · predict its result
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

Look at the sample tables and SQL. Enter the rows you think the query returns, in this column order: trip_id, pickup_at, in_between, in_half_open. 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.

Predict: which trips are in January? — SQL practice · Runtime