Write the SQL statements that will generate the following customer orders summary reports: a. A list of the customers and the total number of orders (invoices) they placed. b. A list of the customers and the total number of products they purchased. c. A list of the customer, the total number of orders (invoices) they placed, the total number of products they purchased, and the total value of what they purchased.
Expert Answer
SELECT count(numbr_of_prodcts) AS “total”,
customer.cust_firstName,customer.cust_lastName,
FROM salesman,customer
WHERE customer.numbr_of_prodcts=customer.numbr_of_prodcts;
select ProductID, sum(Quantity) as TotalQty from Orders group by ProductID
select ProductID,sum(number_of_invoices) as order, sum(total_value) as total, sum(numbr_of_prodcts) as TotalQty from Orders group by ProductID