task LEFT JOIN · medium
Debug: retain members without paid bookings
Return every member and each of their bookings with fee at least 25. Members without a qualifying booking need one NULL fee row. Order by member id then booking id.
what to return
- Columns
idfeein this order- Rows
- 4 rows · in the order asked
- Watch for
- Use the sample data shown here. NULL is not zero or empty text. Keep duplicate result rows.
- Skill
- Repair query semantics and verify the correction on changed data. Refresher: ON versus WHERE in a LEFT JOIN →
expected result
Your query should return exactly these columns and values. Run it and compare.
expected result4 rows · in this order
| id | fee |
|---|---|
| 1 | 30 |
| 2 | NULL |
| 3 | NULL |
first 3 of 4 rows
data you can query
Sample rows from each table. Each column shows its type underneath; → marks a link to another table.
studio_members4 columns · 4 rows
| idinteger · key | nametext | teamtext | creditsinteger |
|---|---|---|---|
| 1 | Luz | Red | 80 |
| 2 | Kit | Red | 80 |
| 3 | Remy | Blue | 50 |
| 4 | Sol | Blue | NULL |
all 4 rows
studio_bookings4 columns · 4 rows
| idinteger · key | member_idinteger → studio_members | feeinteger | booked_attext |
|---|---|---|---|
| 11 | 1 | 20 | 2026-04-01 |
| 12 | 1 | 30 | 2026-04-30 |
| 13 | 2 | NULL | 2026-05-01 |
| 14 | NULL | 20 | 2026-04-15 |
all 4 rows
solution.sql
Hints and the answer are always available. Using them counts the question as solved with help.