Show the names of all customers.
select customer_name from customers
Also show their phone numbers.
select customer_name, customer_phone from customers
For each of them, what is the total product quantity of their orders?
select t1.customer_name, t1.customer_phone, sum(t3.order_quantity) from customers as t1 join customer_orders as t2 on t1.customer_id = t2.customer_id join order_items as t3 on t3.order_id = t2.order_id group by t1.customer_id
Sort the results in descending order of the quantity.
select t1.customer_name, t1.customer_phone, sum(t3.order_quantity) from customers as t1 join customer_orders as t2 on t1.customer_id = t2.customer_id join order_items as t3 on t3.order_id = t2.order_id group by t1.customer_id order by sum(t3.order_quantity) desc
What are the name and phone number of the customer with the most?
select t1.customer_name, t1.customer_phone from customers as t1 join customer_orders as t2 on t1.customer_id = t2.customer_id join order_items as t3 on t3.order_id = t2.order_id group by t1.customer_id order by sum(t3.order_quantity) desc limit 1