On 08/23/2017 12:03 PM, Campbell, Lance wrote:
>
> I am not for sure how to do the below. I was hoping someone could
> share their thoughts.
>
> Assume I have a table called T1. It contains a single filed called
> “viewed” that is of type timestamp.
>
> Every time someone views a particular web page we insert the current
> timestamp into T1.
>
> Now I need to ask this business question:
>
> On average in any consecutive five minute time frame how many times is
> the web page viewed?
>
> Thanks,
>
> Lance
>
window functions are your friends
https://www.postgresql.org/docs/current/static/functions-window.html