The regulars, ranked

Define a totals CTE that computes how much each customer has spent (from invoices), then join it back to customers so every total carries a name and a country. Sort by spend, richest first.

Tables in this exercise
customers
id first_name last_name email city country joined_date support_rep_id
invoices
id customer_id invoice_date billing_city billing_country total

Back to the chapter