Calculate Average Spending per Client
A colleague from the analytics team wants to understand how much, on average, each customer spends per transaction.
You're asked to run a quick report showing these averages so they can identify high-value clients.
To get this insight, you'll use AVG()
along with GROUP BY
to calculate the average transaction amount per customer.
What to Show
From the transactions
table in the bank_transactions.sqlite
database, display:
customer_id
average_spending
(use an alias for the average)
Round the result to 2 decimal places, and sort by average_spending
in descending order to see the top spenders first.
Instructions
Write a SQL query that calculates the average amount spent per transaction for each customer.
Use GROUP BY
to group data by customer_id
, and use ROUND(AVG(...), 2)
to format the average.
Lecture
AI Tutor
Design
Upload
Notes
Favorites
Help
Code Editor
Tables
Execution Result