Skip to main content
All Problems
hard0% acceptance

Each Doctor's Share of Department Salary Budget

For each doctor, compute what percentage of their department's total salary they represent. Use a window function to compute the department total. Return department name, doctor full name, salary, dept_total_salary, and salary_share_pct (rounded to 1 decimal). Order by department name, salary_share_pct descending.

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