QuestionQ276

VerifiedRetrieving Data Using the SQL SELECT Statement

Evaluate this SQL statement:

SELECT ename, sal, 12*sal+100 FROM emp;  

The SAL column contains the employee's monthly salary. What change must be made to the syntax above to calculate annual compensation as “monthly salary plus a monthly bonus of $100, multiplied by 12”?

Explanation

Annual compensation with a $100 monthly bonus is calculated as 12 * (sal + 100). Parentheses cause the salary and monthly bonus to be added before the result is multiplied by 12; multiplication otherwise has precedence over addition.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!