Vehicles Flagged for Recall
Problem
A service centre stores, for each vehicle, a single text field listing diagnostic trouble codes separated by single spaces (it may be empty).
A vehicle must be flagged for the airbag recall when **any** of its codes begins with the prefix `AIRB2` (for example `AIRB2A`, `AIRB2099`). A code like `AIRB300` or `XAIRB2` does **not** count.
Return `vin`, `owner`, and `codes` for the flagged vehicles. Any order.
Tables
Example rows — the live problem includes the full dataset.
| vin | owner | codes |
|---|---|---|
| 1 | Farah | BRK01 COOL |
| 2 | Gideon | |
| 3 | Hugo | AIRB2099 MISF |
Expected output
Your answer should return 2 rows with the columns vin, owner, codes.
Starter code (SQL)
SELECT *
FROM vehicles;Solve this SQL question free
Write SQL and run it instantly in your browser — even on your phone. No signup needed to try.
Solution & explanation
Create a free account to unlock the optimal solution, a step-by-step explanation, and the hidden test cases that grade your answer.
Sign up free to unlock