AnalystPath

Readers Who Never Checked Out a Book

SQLEasyJunior level~15 min

Problem

Table: `Reader`

```text
+-----------+---------+
| Column | Type |
+-----------+---------+
| reader_id | int |
| name | varchar |
+-----------+---------+
reader_id is the primary key. Each row is one library member.
```

Table: `Checkout`

```text
+-------------+---------+
| Column | Type |
+-------------+---------+
| checkout_id | int |
| reader_id | int |
+-------------+---------+
checkout_id is the primary key. Each row records that a reader checked
out a book.
```

Write a query that returns the name of every reader who has never checked out a book. Use the column heading `Reader`.

Return the rows in any order.

**Example**

```text
Reader: Checkout:
+-----------+--------+ +-------------+-----------+
| reader_id | name | | checkout_id | reader_id |
+-----------+--------+ +-------------+-----------+
| 1 | Tamar | | 1 | 3 |
| 2 | Noa | | 2 | 1 |
| 3 | Eli | +-------------+-----------+
| 4 | Yael |
+-----------+--------+

Output:
+--------+
| Reader |
+--------+
| Noa |
| Yael |
+--------+
```

Noa and Yael have no rows in `Checkout`, so they have never checked out a book.

Tables

Example rows — the live problem includes the full dataset.

Reader
reader_idname
1Tamar
2Noa
3Eli
Checkout
checkout_idreader_id
13
21

Expected output

Your answer should return 2 rows with the columns Reader.

Starter code (SQL)

SELECT *
FROM Reader;

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