Introduction
ROWS
8. Rows - exercise 1
RANGE
Default window frame
Revision

Instruction

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

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.

Console

Code editor

Result

TableConsole