agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: Rob Sargent <robjsargent@gmail.com>
To: pgsql-sql@postgresql.org
Subject: Re: how many times
Date: Wed, 23 Aug 2017 12:15:52 -0600
Message-ID: <864a1386-2c98-5060-1a72-d663671af917@gmail.com> (raw)
In-Reply-To: <B75CD08C73BD3543B97E4EF3964B7D7047D3E9E8@CITESMBX1.ad.uillinois.edu>
References: <B75CD08C73BD3543B97E4EF3964B7D7047D3E9E8@CITESMBX1.ad.uillinois.edu>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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

view thread (7+ messages)  latest in thread

Message-ID: <864a1386-2c98-5060-1a72-d663671af917@gmail.com>
Permalink:  ../864a1386-2c98-5060-1a72-d663671af917@gmail.com/
Also on:    postgresql.org/message-id/864a1386-2c98-5060-1a72-d663671af917@gmail.com

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: robjsargent@gmail.com
  Subject: Re: how many times
  In-Reply-To: <864a1386-2c98-5060-1a72-d663671af917@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox