AnalystPath

Books Missing a Record

SQLEasyJunior level~15 min

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.

titles
book_idtitle
1Dawn Tide
2Iron Vale
3Quiet Hours
pricing
book_idprice
230
445

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

Related SQL questions