Tuesday 13 January 2015

Arithmetic Operator Precedence In SQL

In the case of multiple arithmetic operators in a SQL statement, multiplication and division take precedence over addition and subtraction. If the operators are of the same priority, then they are evaluated from left to right.  In the following example, the multiplication process is executed first and then the figure of 1000 is added to the result.


    SQL Statement :

SELECT       last_name, salary, 12 * salary + 1000
FROM          employees;

    Output :






No comments:

Post a Comment