Count Transactions by Customer
You've been asked to review the activity level of each customer by counting how many transactions they've made.
This kind of summary is useful when identifying frequent users or analyzing behavior across a large dataset.
To solve this, you'll use COUNT()
along with GROUP BY
to collapse the data into customer-level counts.
What to Show
From the transactions
table in the bank_transactions.sqlite
database, display:
customer_id
transaction_count
(use an alias forCOUNT(*)
)
Sort the results by transaction_count
in descending order to highlight the most active customers first.
Instructions
Write a SQL query that counts how many transactions each customer has made.
Group the results by customer_id
, and use ORDER BY
to sort from most to fewest transactions.
sqlQuiz
?
Lecture
AI Tutor
Design
Upload
Notes
Favorites
Help
Code Editor
Run
Generate
Tables
Execution Result