Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
ROWS
8. ROWS – practice 1
RANGE
Default window frame
Summary

Instruction

Perfect. Let's do a couple of exercises to practice.

Exercise

Warehouse workers always need to pick ordered products by hand and one by one. For positions with OrderId = 5, calculate the remaining sum of all the products to pick. For each position in that order, show its Id, the ProductId, the Quantity of the product and how many items remain to be picked (including the current row) when sorted by Id in ascending order. Name the column SumQuantity.

Stuck? Here's a hint!

Use:

BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING