Running aggregates are one of the important and useful feature in SQL which is often used in projects. This can be achieved by ROWS UNBOUNDED PRECEDING/FOLLOWING. lets understand this using an example. Suppose you are asked to find the minimum order value till date in each day using payments and orders table.
select DATE(order_purchase_timestamp) as `DATE`, paymnt.payment_value,min(paymnt.payment_value) OVER (PARTITION by DATE(order_purchase_timestamp) ORDER BY DATE(order_purchase_timestamp) desc
ROWS UNBOUNDED PRECEDING) as minimum_payments from hardy-position-352014.ecommerce.orders ord left join `hardy-position-352014.ecommerce.orders-payments` paymnt on ord.order_id = paymnt.order_id