Skip to main content
All Problems
hard0% acceptance

Department Composite Performance Ranking

Create a composite department ranking. Using CTEs, compute for each department: (1) total visits, (2) total revenue from billing, (3) average doctor salary. Then rank departments by total revenue descending. Return department name, total_visits, total_revenue, avg_salary (rounded to 0 decimals), and the revenue rank.

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