Previous |
Next |
SQL supports the basic arithmetic operators: +
(addition), -
(subtraction), *
(multiplication), and /
(division).
The query in the following example displays LAST_NAME
, SALARY
(monthly pay), and annual pay for each employee in department 90, in descending order of SALARY
.
Using an Arithmetic Expression in a Query
SELECT LAST_NAME,
SALARY "Monthly Pay",
SALARY * 12 "Annual Pay"
FROM EMPLOYEES
WHERE DEPARTMENT_ID = 90
ORDER BY SALARY DESC;
Result:
LAST_NAME Monthly Pay Annual Pay ------------------------- ----------- ---------- King 24000 288000 De Haan 17000 204000 Kochhar 17000 204000