TASK #172 · Medium · N26Spending by Merchant Category
Your brief
In the transactions table consider only the rows with
transaction_type = 'card_purchase' (they have a non-NULL
merchant_category).
Write a query that for every category returns merchant_category, total_spent (sum of amounts, rounded to two decimals) and num_purchases — the number of transactions in that category. Sort by total_spent descending.
Write a query that for every category returns merchant_category, total_spent (sum of amounts, rounded to two decimals) and num_purchases — the number of transactions in that category. Sort by total_spent descending.
Ctrl / ⌘ + ↵
Result
Write a query and run it to see the results.
Schema
customerscustomer_id, name, country, signup_datetransactionstransaction_id, customer_id, transaction_type, amount, merchant_category, transaction_at