Simplify Your DB2 SQL Query with these Built-in Functions

DB2 built-in functions are great to use to simplify your SQL query. There are different functions available. Alternative functions improve the understanding of SQL query.

I hope you enjoyed my previous post on some built-in functions.

Use Left side functions (alternative functions) instead of Right side functions:

  • ABS => ABSVAL
  • COALESCE=> VALUE, IFNULL
  • DAY=> DAYOFMONTH
  • DECIMAL=>DEC
  • DOUBLE => FLOAT
  • GREATEST => MAX (scalar)
  • INTEGER=> INT
  • LEAST=> MIN (scalar)
  • LOG=> LN
  • LOWER => LCASE
  • TIMESTAMP_FORMAT => TO_DATE
  • TRUNCATE => TRUNC
  • UPPER=> UCASE
  • VARIANCE=> VAR
  • VARIANCE_SAMP => VAR_SAMP

{Ref:IBM and Mullins}

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.

Comments are closed.