AnalystPath

Total Pages Read per Library Member

SQLEasyJunior level~15 min

Problem

Tables: `members`, `loans`

**members**
| Column Name | Type |
|---|---|
| member_id | int |
| full_name | varchar |

`member_id` is the primary key.

**loans**
| Column Name | Type |
|---|---|
| loan_id | int |
| member_id | int |
| pages_read | int |

`loan_id` is the primary key. Each row records how many pages a member read from one borrowed book.

Report the total pages read by every member. A member with no loans must still appear with a total of 0. Output `member_id`, `full_name`, and the total aliased as `pages read`. Order by `member_id`.

Tables

Example rows — the live problem includes the full dataset.

members
member_idfull_name
3Priya Nair
7Diego Alves
12Hannah Berg
loans
loan_idmember_idpages_read
13120
2380
37300

Expected output

Your answer should return 4 rows with the columns member_id, full_name, pages read.

Starter code (SQL)

SELECT *
FROM members;

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