39. Doctor Admission Cost (Left)

Hard Left Join
Query Rules
  • The query columns and order must match the expected result schema.
  • NULL values should be handled appropriately where applicable.
  • The grader compares output values and sorting order to evaluate.

Schema Browser

Click a table's header to toggle expand/collapse.
patients
10 cols
doctors
4 cols
admissions
7 cols
province_names
2 cols

Reference Solution

Expected SQL
SELECT d.last_name, COALESCE(SUM(a.admission_cost), 0) FROM doctors d LEFT JOIN admissions a ON d.doctor_id = a.attending_doctor_id GROUP BY d.last_name;
SQL Editor
Ctrl+Enter to run
Console Output

Console Terminal

Write your query and click "Run Query" (Ctrl + Enter) to see results and testcase validation.