How many payment records are there?
select count(*) from payments
Show me the maximum amount paid?
select amount_paid from payments order by amount_paid desc limit 1
What about the total maximum amount paid by a single customer?
select sum(amount_paid) from payments group by customer_id order by sum(amount_paid) desc limit 1
Show me the customer id also.
select customer_id, sum(amount_paid) from payments group by customer_id order by sum(amount_paid) desc limit 1