Show all the customer ids, and names!
select id, first_name, last_name from customers
How any invoices do each of them have?
select t1.id, t1.first_name, t1.last_name, count(*) from customers as t1 join invoices as t2 on t2.customer_id = t1.id group by t1.id;
What are their total gross sales?
select t1.id, t1.first_name, t1.last_name, count(*), sum(t2.total) from customers as t1 join invoices as t2 on t2.customer_id = t1.id group by t1.id;
Show just the names of the customers, and their total gross sales for the top 10 in gross sales!
select t1.first_name, t1.last_name, sum(t2.total) from customers as t1 join invoices as t2 on t2.customer_id = t1.id group by t1.id order by sum(t2.total) desc limit 10;