Hands-on task
SQLite: running total
The database /root/shop.db has a table sales(day INTEGER, amount INTEGER) — revenue by day. Write a query with the window function SUM(...) OVER (ORDER BY ...) that, for each day, produces a running total (the sum of revenue from the first day through the current one), and write the result to /root/running.txt in the format day|amount|total.
- window functions
- running total
- sum over
- order by
- sqlite3