Question: SELECT customers.email _ address, COUNT ( orders . order _ id ) AS order _ count, SUM ( ( order _ items.item _ price -

SELECT
customers.email_address,
COUNT(orders.order_id) AS order_count,
SUM((order_items.item_price - order_items.discount_amount)* order_items.quantity) AS order_total
FROM customers
JOIN orders on customers.customer_id = orders.customer_id
JOIN order_items ON orders.order_id = order_items.order_id
GROUP BY customers.email_address
HAVING COUNT(order_items.order_id)>1
ORDER BY order_total DESC;

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!