The SQL statement SELECT ROUND(45.926, -1) FROM DUAL;

2025

The SQL statement

SELECT ROUND(45.926, -1) FROM DUAL;

  1. A.

    is illegal

  2. B.

    prints garbage

  3. C.

    prints 045.926

  4. D.

    prints 50

Attempted by 752 students.

Show answer & explanation

Correct answer: D

Answer: Option D

Solution:

The ROUND function in SQL is used to round a number to a specified precision. The syntax is:

ROUND (expression, [decimal place])

where [decimal place] indicates the number of decimal points returned. A negative number means the rounding will occur to the digit to the left of the decimal point. For example, -1 means the number will be rounded to the nearest tens.

For above given example, the output would be 50 because the nearest tens of 45.926, is 50.

Taking another example, if we have to round (44.678, -1), the out put would be 40, because the nearest tens of 44.678 is 40.

Explore the full course: Cognizant Preparation