From: | "Campbell, Lance" <lance(at)illinois(dot)edu> |
---|---|
To: | Rob Sargent <robjsargent(at)gmail(dot)com>, "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: how many times |
Date: | 2017-08-23 18:35:31 |
Message-ID: | B75CD08C73BD3543B97E4EF3964B7D7047D3FA88@CITESMBX1.ad.uillinois.edu |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
I appreciate your response but I don't see how to apply this to five minute time frames?
Thanks,
Lance
From: pgsql-sql-owner(at)postgresql(dot)org [mailto:pgsql-sql-owner(at)postgresql(dot)org] On Behalf Of Rob Sargent
Sent: Wednesday, August 23, 2017 1:16 PM
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: [SQL] how many times
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
From | Date | Subject | |
---|---|---|---|
Next Message | David G. Johnston | 2017-08-23 19:12:21 | Re: how many times |
Previous Message | Rob Sargent | 2017-08-23 18:15:52 | Re: how many times |