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
7. First exercise
RANGE
Default window frame
Summary

Instruction

Okay! It's your turn to write a query!

Here is a syntax reminder:

SELECT
  id,
  quantity,
  changed,
  SUM(quantity) OVER(
    ORDER BY changed
    ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)
FROM stock_change

Exercise

For each order, show its id, the placed date, and the third column which will count the number of orders up to the current order when sorted by the placed date.

Stuck? Here's a hint!

Within the parentheses of OVER(...), sort the rows by the placed date. Then, introduce the keyword ROWS and use the BETWEEN ... AND ... construction.