Management wants to compare prescribing habits. For each doctor, calculate the average number of prescriptions per visit. Return the doctor's full name, total visits, total prescriptions, and the average prescriptions per visit (rounded to 2 decimals). Only include doctors who have at least one visit. Sort by average 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