Re: how many times

From: Rob Sargent <robjsargent(at)gmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: how many times
Date: 2017-08-23 18:15:52
Message-ID: 864a1386-2c98-5060-1a72-d663671af917@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Campbell, Lance 2017-08-23 18:35:31 Re: how many times
Previous Message Campbell, Lance 2017-08-23 18:03:39 how many times