runtime
73 / 139

task NULL handling · easy

Predict: unknown passenger counts in a filter

Predict the trips returned by a filter for passenger counts other than 1.

what to return

Columns
trip_idpassenger_count 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: Understand NULL →

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.

trip_sample3 columns · 7 rows
trip_idpassenger_countpayment_type_id
1014
1112
1214
1311
14NULL0
1531
trip_id
10
passenger_count
1
payment_type_id
4
trip_id
11
passenger_count
1
payment_type_id
2
trip_id
12
passenger_count
1
payment_type_id
4
trip_id
13
passenger_count
1
payment_type_id
1
trip_id
14
passenger_count
NULL
payment_type_id
0
trip_id
15
passenger_count
3
payment_type_id
1

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

predict.sql
SELECT trip_id, passenger_count
FROM trip_sample
WHERE passenger_count <> 1
ORDER BY trip_id
Read the query · predict its result
SELECT trip_id, passenger_count FROM trip_sample WHERE passenger_count <> 1 ORDER BY trip_id

Look at the sample tables and SQL. Enter the rows you think the query returns, in this column order: trip_id, passenger_count. Put each row in square brackets, then wrap all rows in another pair of brackets (JSON format). For example, [[1,null]] is one row with 2 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: unknown passenger counts in a filter — SQL practice · Runtime