When aggregate function returns NULL value

DB2 Aggregate functions also called Column functions.

Example:

SELECT MAX(VALUE_1) FROM SAMPLES.TABLE_1;

Rules:

  • All aggregate functions, we need to use only in SELECT statement
  • If no row found, we will not get +100 sqlcode, instead we will get NULL value
  • The return value from all Aggregate functions can be NULL, but for COUNT and COUNT_BIG always numeric result
  • COUNT always return integer
  • COUNT_BIG always return DECIMAL
  • DISTINCT can be applied on all aggregate functions. But has no effect on MAX and MIN functions
Advertisements

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.