Chapter 9 · Interview Level
21. Customers Using Multiple Payment Methods
Medium20 XPE-Commerce
Find customers who have used more than one distinct payment method across all their orders. Return the customer's full name, the number of distinct payment methods they've used, and their total spending (sum of payment amounts, rounded to 2 decimals). Only consider completed payments. Sort by distinct_methods descending.
Tables
- PKidINT
- first_nameTEXT
- last_nameTEXT
- emailTEXT
- phoneTEXT
- cityTEXT
- stateTEXT
- countryTEXT
- created_atTIMESTAMP
- PKidINT
- FKcustomer_id→ customers.idINT
- order_dateTEXT
- statusTEXT
- total_amountREAL
- PKidINT
- FKorder_id→ orders.idINT
- payment_dateTEXT
- amountREAL
- methodTEXT
- statusTEXT
Need help?
Ask Sol
AI tutor — looks at your current query and nudges you, without spoiling the answer.
Solution
Try the hints first — solving it yourself is what makes it stick.