Difference between ceiling, Floor, Abs, Round?

2.2K    Asked by DanielCameron in SQL Server , Asked on Nov 1, 2019
Answered by Rachit Gupta

All these functions are used in the mathematical expression mainly in the decimal variables.

Ceiling is used to round the decimal value to higher whole digit no.

Floor is used to round the decimal value to lower whole digit no.

Abs is used to return the positive value of any value send in parameter

Round is used to round the values to limit decimal places

SELECT CEILING(-34.5524) CEILING_OF_NEGATIVE ,FLOOR (-34.5524) FLOOR_OF_NEGATIVE ,

ABS(-34.5524) ABS_OF_NEGATIVE, ROUND(-34.2495,2) ROUND_OF_NEGATIVE, ROUND(-34.2435,2)ROUND_OF_NEGATIVE


The ceiling for negative numbers will be -34.5524 be -34. ABS functions always return the positive value of the parameter inserted.

SELECT CEILING(34.5524) CEILING_OF_POSITIVE , FLOOR (34.5524) FLOOR_OF_POSITIVE ,

ABS( 34.5524) ABS_OF_POSITIVE, ROUND(34.2495,2) ROUND_OF_HIGHER_POSITIVE , ROUND(34.2435,2) ROUND_OF_LOWER_POSITIVE




Your Answer

Interviews

Parent Categories