Calculation of values in one or more columns

You can perform calculations on numeric or datetime data.

The numeric data types are binary integer, floating-point, and decimal. The datetime data types are date, time, and timestamp.

You can retrieve calculated values, just as you display column values, for selected rows.

Begin general-use programming interface information.
Example 1
Consider this query:
SELECT EMPNO,
  SALARY / 12 AS MONTHLY_SAL,
  SALARY / 52 AS WEEKLY_SAL
  FROM DSN8D10.EMP
  WHERE WORKDEPT = 'A00';

The result table looks like the following example:

EMPNO       MONTHLY_SAL         WEEKLY_SAL
=====			 ===========				 ==========
000010      4395.83333333       1014.42307692
000110      3875.00000000       894.23076923
000120      2437.50000000       562.50000000
200010      3875.00000000       894.23076923
200120      2437.50000000       562.50000000

The result table displays the monthly and weekly salaries of employees in department A00. If you prefer results with only two digits to the right of the decimal point, you can use the DECIMAL function.

Example 2
To retrieve the department number, employee number, salary, and commission for those employees whose combined salary and commission is greater than $45,000, write the query as follows:
SELECT WORKDEPT, EMPNO, SALARY, COMM
  FROM DSN8D10.EMP
  WHERE SALARY + COMM > 45000;

The result table looks like following example:

DEPT     EMPNO      SALARY        COMM
====     ======     ========      =======
A00      000010     52750.00      4220.00
A00      000110     46500.00      3720.00
A00      200010     46500.00      4220.00
End general-use programming interface information.