AnalystPath

Tuition Collected by Each Tutor

SQLMediumMid level~15 min

Problem

A tutoring center tracks tutors, the students assigned to each tutor, and the tuition payments those students make.

The `Tutor` table lists every tutor. The `Student` table maps each student to the tutor who teaches them. The `Payment` table records the amount of each tuition payment a student makes.

Write a query that reports, for every tutor, the total tuition collected from all of their students. A tutor who has no students, or whose students have made no payments, must still appear with a total of `0`.

Return the result in any order. The result columns are `tutor_id`, `tutor_name`, and `collected`.

Tables

Example rows — the live problem includes the full dataset.

Tutor
tutor_idtutor_name
11Dana
12Omar
13Priya
Student
student_idtutor_id
10111
10211
10312
Payment
payment_idstudent_idamount
1102320
2101145
3103410

Expected output

Your answer should return 3 rows with the columns tutor_id, tutor_name, collected.

Starter code (SQL)

SELECT *
FROM Tutor;

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