For each doctor, show their department name, salary, the name of the highest-paid doctor in their department (top_earner), and the name of the lowest-paid (lowest_earner). Use FIRST_VALUE and LAST_VALUE window functions. Order by department name, salary 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