January 21st, 2009

Column Functions with Calculations

Posted by admin in J. Column Functions

Column function expressions can be used in the SELECT clause to perform calculations. We have a table: EMPLOYEE_TBL

If we wanted to know the difference between the minimum and maximum RATE_HOUR, we could do the following:

                    SELECT (MAX(RATE_HOUR) – MIN(RATE_HOUR))
                      FROM EMPLOYEE_TBL;

Result Table:

                   

Calculations are evaluated in the following order:
1. Expressions within parentheses with the innermost first.
2. Multiplication and division.
3. Addition and subtraction.
4. Left to right.

Comments are closed.

Sorry, the comment form is closed at this time.