Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question: - - Premium customers are those customers who have placed orders with order amounts greater than the average order amount. For each customer, find
Question:
Premium customers are those customers who have placed orders with order amounts greater than the average order amount. For each customer, find the first and last names, and the order amount for all orders that exceeded the average order amount?
SELECT customer.firstname, customer.lastname, sumorderline.quantitysold product.productprice as Ordertotal
FROM customer, orderline,product, orders
INNER JOIN orders ON orders.customerId customer.customerid
INNER JOIN
SELECT orderid
FROM orderline
INNER JOIN product ON product.productid orderline.productid
GROUP BY orderid
AS orders ON orders.orderid orderline.orderid
WHERE orderline.ordertotal
SELECT AVGSUMquantitysold productprice
FROM orderline, product
INNER JOIN product ON orderline.productid product.productid
GROUP BY orderline.orderid
;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started