MIN
Purpose
This function returns the minimum value of expr from the window or group of rows.
Syntax
min::=
Usage Notes
DISTINCT has no effect.
Examples
Aggregate Function
Result
DEPARTMENT | MIN_CURRENT_SALARY |
ACCOUNTS | 55000 |
HR | 55000 |
Analytic Function
SELECT
id, department, hire_date, current_salary,
MIN(current_salary) OVER (PARTITION BY department ORDER BY hire_date) MIN_CURRENT_SALARY
FROM employee_table ORDER BY department, hire_date;
Result
ID | DEPARTMENT | HIRE_DATE | CURRENT_SALARY | MIN_CURRENT_SALARY |
2005 | ACCOUNTS | 2013-01-01 | 80000 | 80000 |
2003 | ACCOUNTS | 2015-07-01 | 80000 | 80000 |
2002 | ACCOUNTS | 2017-01-01 | 65000 | 65000 |
2004 | ACCOUNTS | 2017-01-01 | 70000 | 65000 |
2001 | ACCOUNTS | 2018-07-01 | 55000 | 55000 |
1003 | HR | 2014-01-01 | 90000 | 90000 |
1002 | HR | 2016-01-01 | 70000 | 70000 |
1004 | HR | 2016-01-01 | 70000 | 70000 |
1001 | HR | 2018-01-01 | 55000 | 55000 |