Identify visits where the billing amount exceeded the average billing amount for that doctor. Return visit_id, doctor_id, amount, and the doctor's average billing as doctor_avg_amount (rounded to 2 decimals). Order by amount descending.
Schema
🔑idINT
🔗patient_idINT
🔗doctor_idINT
visit_dateTEXT
diagnosisTEXT
notesTEXTNULL
follow_up_dateTEXTNULL
statusTEXT
postgresql
Run your query to see results
Press Ctrl + Enter to execute