SQL CEIL Vs FLOOR Function
In SQL , the fundamental distinction between
FLOOR is that CEIL assists in obtaining the lowest integer value that is more than or equal to a number.
whereas FLOOR assists in obtaining the greatest integer value that is less than or equal to number.
SQL CEIL Function
The CEIL() function is used to find the smallest integer value greater than or equal to a given number.
Example 1: When there is a poisitive number in the argument.--Sqlserver,Mysql,Ms access
Output: The output of positive number argument is
Example 2: When there is a negative number in the argument.
Output: The output of negative argument is
SQL FLOOR FUNCTION
The FLOOR () function is useful for finding the greatest integer value that is less than or equal to a given number.
The second input D and the number itself (digit after D decimal places >=5 or not) determine whether the
ROUND() function rounds the number up or down.
The FLOOR() method rounds the number to the nearest tenth value.
Example 1: When the argument holds a positive number.
Output: The result of postive floor number is
Example 2 : When the argument holds a negative number.
Output: The result of negative floor number will be
SQL Difference Between CEIL And FLOOR Function
There is 1 main contrast between ceil & floor function discussed in below table:-
|CEIL() is a function that lets you find the lowest integer value that is greater than or equal to a given number.||FLOOR() can be used to get the largest integer value that is less than or equal to a given number.|