Back to problems

Find Total Sales by Unique Customers

SQL · Meta · Easy

Problem You have four tables: books, authors, transactions, and customers. Write a SQL query that calculates the total sales amount for each distinct customer and sorts the results from the greatest total to the smallest. For this task, each transaction is represented as (customer_id, sale_amount), and the customer table supplies the available customer IDs. Repeated transactions for the same customer must be combined into one total. The books and authors tables are available…

Checking your access…