A payments table records every payment made.
SQL
customer_name TEXT
amount INTEGER
paid_on DATE
For each calendar month that has at least one payment, return the name of the customer who paid the most in that month, alongside the month.
- One row per month, ordered by month ascending (
YYYY-MM).
- If two customers tie for the top in a month, return the one whose name is alphabetically first.
- Output columns, in order:
month (formatted YYYY-MM), customer_name.