Skip to main content
All Problems
hard0% acceptance

Doctor Revenue-to-Salary Efficiency Ratio

Calculate each doctor's revenue-to-salary ratio to measure financial efficiency. Using a CTE, compute total revenue generated (sum of billing amounts for their visits), then divide by salary to get the ratio. Return doctor full name, department name, salary, total_revenue, revenue_to_salary_ratio (rounded to 2 decimals), and DENSE_RANK by ratio descending across the entire hospital. Sort by 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