pleasse write in detail e,f,g e) Display the WarehouseID and the sum of Quantity
ID: 3750117 • Letter: P
Question
pleasse write in detail e,f,g
e) Display the WarehouseID and the sum of QuantityOnfland, grouped by WarehouselD. Name the sum TotalltemsOnHand and display the results in descending order of TotalItemsOnHand (5 points) f) Display the WarehouselD and the sum of QuantityOnHand grouped by WarehouselD. Omit all SKU items that have 3 or more items on hand from the sum, and name the sum Totalltems. Show Warehouse ID only for warehouses having fewer than 2 SKUs in their TotalItems. Display the results in descending order of Totalltems. (9 points) Display the WarehouselD, the sum of QuantityOnOrder and sum of QuantityOnHand, grouped by WarehouselD and QuantityOnOrder. Name the sum of QuantityOnOrder as TotalItemsOnOrder and the sum of QuantityOnHand as TotalltemsOnHand. (8 points) g)Explanation / Answer
(e)-->
SELECT WarehouseID, SUM(QuantityOnHand) as TotalItemsOnHand from INVENTORY GROUP BY WarehouseID ORDER BY TotalItemsOnHand DESC;
(f)-->
SELECT WarehouseID, SUM(QuantityOnHand) as TotalItems from INVENTORY WHERE QuantityOnHand<3 GROUP BY WarehouseID HAVING TotalItems<2 ORDER BY TotalItems desc;
(g)-->
SELECT WarehouseID, SUM(QuantityOnOrder) as TotalItemsOnOrder, SUM(QuantityOnHand) as TotalItemsOnHand from INVENTORY GROUP BY WareHouseID, QuantityOnOrder;
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.