It's Autumn! Prices fall like leaves! - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
ROWS
8. Rows – exercise 1
RANGE
Default window frame
Summary

Instruction

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

Exercise

Warehouse workers always need to pick the products for orders by hand and one by one. For positions with order_id = 5, calculate the remaining sum of all the products to pick. For each position from that order, show its id, the id of the product, the quantity and the quantity of the remaining items (including the current row) when sorted by the id in the ascending order.

Stuck? Here's a hint!

Use: BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING.