Books Missing a Record
Problem
Table: `titles`
| Column Name | Type |
|---|---|
| book_id | int |
| title | varchar |
`book_id` is the unique key. Each row gives a book's title.
Table: `pricing`
| Column Name | Type |
|---|---|
| book_id | int |
| price | int |
`book_id` is the unique key. Each row gives a book's price.
A book has incomplete information when it is missing from one of the two tables: it has a title but no price, or a price but no title. Return the `book_id` of every book with incomplete information, ordered by `book_id` ascending.
Tables
Example rows — the live problem includes the full dataset.
| book_id | title |
|---|---|
| 1 | Dawn Tide |
| 2 | Iron Vale |
| 3 | Quiet Hours |
| book_id | price |
|---|---|
| 2 | 30 |
| 4 | 45 |
Expected output
Your answer should return 3 rows with the columns book_id.
Starter code (SQL)
SELECT *
FROM titles;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