Question: The code below produce results in Fig. 1 . Please produce code that will give the results in Fig. 2. Fig. Therefore Fig.2 shows the

The code below produce results in Fig. 1. Please produce code that will give the results in Fig. 2. Fig. Therefore Fig.2 shows the MinOrders in the CategoryName and Shipper

SQL Code:

SELECT CategoryName, CompanyName, MIN(OrderCount) AS MinOrdersShipped

FROM ( SELECT C.CategoryName, S.CompanyName

,O.ShipVia

,COUNT(O.OrderID) AS 'OrderCount'

FROM Orders O

INNER JOIN Shippers S

ON O.ShipVia = S.ShipperID

INNER JOIN [Order Details] D

ON O.OrderID = D.OrderID

INNER JOIN Products P

ON D.ProductID = P.ProductID

INNER JOIN Categories C

ON P.CategoryID = C.CategoryID

GROUP BY C.CategoryName,S.CompanyName, O.ShipVia

) AS SHIPCATCOUNT

GROUP BY CategoryName, CompanyName

ORDER BY CategoryName

The code below produce results in Fig. 1. Please produce code that

Fig. 1 1 Beverages Federal Shipping 118 2 Beverages Speedy Express 122 3 Beverages United Package 164 4Condiments Federal Shipping 63 5 Condiments Speedy Express 72 6 Condiments United Package 81 7 Confections Federal Shipping 101 8 Confections Speedy Express 100 9 Confections United Package 133 0 Dairy Products Federal Shipping 108 1 Dairy Products Speedy Express 115 12 Dairy Products United Package 143 13 Grains/Cereals Federal Shipping 56 14 Grains/Cereals Speedy Express 59 15 Grains/Cereals United Package 81 16 Meat/Poultry Federal Shipping 57 7 Meat/Poultry Speedy Express 44 8 Meat/Poultry Uhited Package 72 19 Produce 20 Produce 21 Produce 22 Seafoo Federal Shipping 102 23 Seafood 24 Seafood Federal Shipping 40 Speedy Express 39 United Package 57 Speedy Express 95 United Package 133 Fig. 2 MinOrders CategoryName Shipper Beverages Federal Shipping 118 Condiments Federal Shipping 63 Confections Speedy Express 100 Dairy Products Federal Shipping 108 Grains/Cereals Federal Shipping 56 Meat/PoultrySpeedy Express 44 Produce Seafood Speedy Express 39 Speedy Express 95

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!