Using CTEs, calculate the monthly visit count and the month-over-month change in visits. Return the month (as YYYY-MM), visit count, previous month count, and the change. Order by month.
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