Newer versions of PostgreSQL offer an enhancement to SQL known as
A typical use case for a window function is to start with a table of
stock prices with these columns:
stock_symbol, price_date, price
Then specify that you want an additional column:
stock_symbol, price_date, price, price20day_moving_avg
I offer some syntax examples of "Window Functions" in my latest blog entry:
The examples are for Oracle but they should be good enough to get you
started writing Window Functions for Postgres.
A good time for you to wrestle with this syntax is on a Sunday Hackternoon:
-- Dan, Creator of the DanBot
Some traders make their own luck.
We use a robot.