# Function - (Moving|Rolling|Running) Calculation

(Moving|Rolling|Running) Calculation are computed with window function.

## Example

### Running total

For example, running total of sum (sal + comm) department wise on emp table :

Oracle in Sqlplus:

``````break on deptno skip 1

select
deptno,
empno,
sum(sal+nvl(comm,0)) over (partition by deptno order by empno) running_total
from
scott.emp
order by
deptno,
empno;```
```
``````DEPTNO      EMPNO  RUNNING_TOTAL
---------- ---------- ----------
10       7782       2450
7839       7450
7934       8750

20       7369        800
7566       3775
7788       6775
7876       7875
7902      10875

30       7499       1900
7521       3650
7654       6300
7698       9150
7844      10650
7900      11600
```
```

Discover More
Number - Addition (or Sum, Sigma) or Total

The addition of all numbers in a set is called a total. Sum can be use as: an aggregate or a analytic function. It can follow the full syntax of the analytic function and in this way create It's...
SQL Function - Window Aggregate (Analytics function)

Windowing functions (known also as analytics) allow to compute: cumulative, moving, and aggregates. They are distinguished from ordinary SQL functions by the presence of an OVER clause. With...
Time Serie - Moving Average (MA) - (Rolling|running)

(moving|rolling|running) average A moving average is commonly used with time series data to smooth out short-term fluctuations and highlight longer-term trends or cycles (Seasonality). Variations include:...