Looking Up Offset Rows in PostgreSQL

A common task when either reporting or doing data analysis is to extract data from a database table or view and then lookup corresponding values from either previous or next rows. A good example of this was a recent KPI report I made for E-commerce where the KPI depended not only on the total daily …