Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Moving average function

Re: Moving average function

From: Vladimir M. Zakharychev <bob_at_dpsp-yes.com>
Date: Thu, 14 Nov 2002 13:08:17 +0300
Message-ID: <aqvsql$s34$1@babylon.agtel.net>


Look at so-called analytic functions. Moving average would probably look like this:

SELECT AVG(column) OVER (window definition) "Moving Average" FROM T;

where <window definition> defines a sliding window into T over which AVG() will be applied (RANGE or ROWS). These functions were introduced in Oracle8i 8.1.6. Reference and examples can be found in SQL Reference, and for a good overview and explanation of the feature I'd recommend Tom Kyte's "Expert one on one: Oracle" book.

--
Vladimir Zakharychev (bob@dpsp-yes.com)                http://www.dpsp-yes.com
Dynamic PSP(tm) - the first true RAD toolkit for Oracle-based internet applications.
All opinions are mine and do not necessarily go in line with those of my employer.


"gamaz" <gamaz_at_eathlink.net> wrote in message
news:dYGA9.3631$Bh1.365036_at_newsread1.prod.itd.earthlink.net...

> Could anybody tell me where I could find concept of moving average with
> regard to Oracle? Thanks.
>
>
Received on Thu Nov 14 2002 - 04:08:17 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US