Calculate Average Spending per Client
The analytics team wants to understand how much each customer spends on average per transaction.
You’ve been asked to prepare a quick report to help identify high-value clients.
You’ll use the AVG() function with GROUP BY to calculate the average transaction amount per customer.
Task
From the transactions table in the bank_transactions.sqlite database, display:
customer_idaverage_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.
How to solve it
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.
sqlQuiz
?
Lecture
AI Tutor
Design
Upload
Notes
Favorites
Help
Code Editor
Run
Generate
Tables
Execution Result