Save up to $499! Grab all Python courses for $49 or all online courses we’ve ever launched for only $169. Only Feb 11-16. Happy Valentine's!
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.