1.       SQL Week 2 Question 200-506] Last

1.       SQL Week 2 Question 200-506] Last one!    You want to know how many times products were shipped to customers.  Note you want the total number of shipments, not the number of items shipped – one shipment of 10 items and one shipment of 20 items would be two shipments, not 30 items.

a.       Include all products, even if they had no shipments.  In this case, their count would be 0.

b.       Include the manufacturer and the product name

c.       Include the customer company name

d.       Sort it so the smallest count of shipments is on top.  After that, sort ascending by Manufacturer name and then product name.

 



honeyd


12-09-20 | 15:01:26

Select Manufacturer, ProductName, CompanyName, count(quantity) as How_many_shipments FROM Shipment s join customer c On s.Customer_idCustomer= c.idCustomer right Join product p ON p.idproduct=s.Product_idProduct group by count(quantity) order by count(quantity) asc, manufacturer asc, ProductName asc;

Login to answer this question!