LogiQuest

510. Running Total of Orders

HardWindow FunctionsSUM OVER

Return every order's id, order_date, amount and the running total of amounts in date order as running_total. Order by order_date.

customers

idnamecity
1AnilDelhi
2BinaChennai
3ChetanDelhi
4DivyaKolkata
5EshaChennai

orders

idcustomer_idamountorder_date
115002024-01-05
217002024-02-10
322002024-01-20
4315002024-03-01
528002024-03-15
613002024-03-20
7510002024-02-01

Your query runs on a fresh copy of these tables (SQLite). Column names in your result do not need to match.

Loading the MyLoginn IDE…