nerdexam
Oracle

1Z0-007 · Question #69

Evaluate this SQL statement: SELECT ename, sal, 12*sal+100 FROM emp; The SAL column stores the monthly salary of the employee. Which change must be made to the above syntax to calculate the annual…

The correct answer is B. SELECT ename, sal, 12*(sal+100) FROM emp. to achieve the result you must add 100 to sal before multiply with 12. Select ename, sal, 12*(sal+100) from EMP; Incorrect answer: A Multiplication and division has priority over addition and subtraction in Operator precedence. C Give wrong results

Basic SQL SELECT Statements

Question

Evaluate this SQL statement:

SELECT ename, sal, 12*sal+100 FROM emp; The SAL column stores the monthly salary of the employee. Which change must be made to the above syntax to calculate the annual compensation as "monthly salary plus a monthly bonus of $100, multiplied by 12"?

Options

  • ANo change is required to achieve the desired results.
  • BSELECT ename, sal, 12*(sal+100) FROM emp;
  • CSELECT ename, sal, (12*sal)+100 FROM emp;
  • DSELECT ename, sal+100,*12 FROM emp;

How the community answered

(23 responses)
  • A
    4% (1)
  • B
    74% (17)
  • C
    13% (3)
  • D
    9% (2)

Explanation

to achieve the result you must add 100 to sal before multiply with 12. Select ename, sal, 12*(sal+100) from EMP; Incorrect answer: A Multiplication and division has priority over addition and subtraction in Operator precedence. C Give wrong results

Topics

#arithmetic operators#operator precedence#parentheses#expressions

Community Discussion

No community discussion yet for this question.

Full 1Z0-007 Practice