MUL
Purpose
This function returns the product of expr within a window or group of rows.
Syntax
mul::=
Usage Notes
- With
DISTINCT, the function considers duplicate values ofexpronly once. It considers all occurrences withALL. If the function contains neitherALLnorDISTINCT, the default isALL. -
This function supports only arguments of type
numeric. - The return type of this function is always
DOUBLE PRECISION.
Examples
Aggregate Function
SELECT MUL(annual_inflation) total_inflation_rate FROM inflation_rates;
Analytic Function
SELECT
relevant_year, MUL(annual_inflation) OVER (ORDER BY relevant_year ASC ROWS BETWEEN 4 PRECEDING AND CURRENT ROW)
inflation_last_five_years FROM inflation_rates;
Result
| RELEVANT_YEAR | INFLATION_LAST_FIVE_YEARS |
| 2019 | 0.9562890809252812 |
| 2018 | 0.6718044944677499 |
| 2017 | 0.5488795376685 |
| 2016 | 0.73397238276636 |
| 2015 | 3.150062672356664 |
| 2014 | 6.799120347140375 |
| 2013 | 2.1860055962437137 |
| 2012 | 1.516164236540237 |
| 2011 | 0.7596774408960001 |
| 2010 | 0.35401344 |
| 2009 | 0.3264 |