WINDOW FUNCTION MIN

description

The LEAD() method is used to calculate the minimum value within the window.

  1. MAX([DISTINCT | ALL] expression) [OVER (analytic_clause)]

example

Calculate the minimum value from the first row to the row after the current row

  1. select x, property,
  2. min(x) over
  3. (
  4. order by property, x desc
  5. rows between unbounded preceding and 1 following
  6. ) as 'local minimum'
  7. from int_t where property in ('prime','square');
  8. | x | property | local minimum |
  9. |---|----------|---------------|
  10. | 7 | prime | 5 |
  11. | 5 | prime | 3 |
  12. | 3 | prime | 2 |
  13. | 2 | prime | 2 |
  14. | 9 | square | 2 |
  15. | 4 | square | 1 |
  16. | 1 | square | 1 |

keywords

  1. WINDOW,FUNCTION,MIN