Lecture

Count Transactions by Customer

You’ve been asked to analyze customer activity levels by counting how many transactions each customer has made.

This type of summary helps identify frequent users and reveal behavioral patterns in large datasets.

You’ll use COUNT() together with GROUP BY to calculate transaction totals per customer.


Task

From the transactions table in the bank_transactions.sqlite database, display:

  • customer_id
  • transaction_count (use an alias for COUNT(*))

Sort the results by transaction_count in descending order to highlight the most active customers first.


How to solve it

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