Find the doctor with the highest total billing in each department. Return the department name, doctor name, and their total billing amount. Use ROW_NUMBER to pick the top one per department.
Schema
🔑idINT
first_nameTEXT
last_nameTEXT
specialtyTEXT
🔗department_idINT
emailTEXT
phoneTEXT
hire_dateTEXT
salaryREAL
postgresql
Run your query to see results
Press Ctrl + Enter to execute