MySQL CEILING() function
CEILING() function
MySQL CEILING() returns the smallest integer value not less than the number specified as an argument. The synonym of CEILING() is CEIL().
This function is useful in -
- CEILING() ensures that values are always rounded up, which can be important for accurate calculations.
- In scenarios where a minimum quantity is required, CEILING() ensures that the quantity ordered is at least a certain amount, even if the user inputs a smaller value.
- In certain statistical analyses, it may be necessary to round up data points to ensure that they are within the desired range or meet specific criteria.
- CEILING() is useful in inventory management and order fulfillment systems to make sure enough of an item is ordered, even if it is not a whole number.
- By rounding up instead of down, CEILING() prevents significant errors caused by rounding down.
- When certain conditions or thresholds must be met, CEILING() ensures that the value falls within those limits.
Syntax:
CEILING(N);
Argument:
Name | Description |
---|---|
N | A number. |
Syntax Diagram:
MySQL Version: 8.0
Example:
Code:
SELECT CEILING(2.2536);
Explanation:
The above MySQL statement returns 3 which is the smallest integer value not less than the value specified (2.2536) in the argument.
Output:
mysql> SELECT CEILING(2.2536); +-----------------+ | CEILING(2.2536) | +-----------------+ | 3 | +-----------------+ 1 row in set (0.00 sec)
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://www.w3resource.com/mysql/mathematical-functions/mysql-ceiling-function.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics