MySQL 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.
MySQL Version: 8.0
The above MySQL statement returns 3 which is the smallest integer value not less than the value specified (2.2536) in the argument.
mysql> SELECT CEILING(2.2536); +-----------------+ | CEILING(2.2536) | +-----------------+ | 3 | +-----------------+ 1 row in set (0.00 sec)
- Weekly Trends
- Python Interview Questions and Answers: Comprehensive Guide
- Scala Exercises, Practice, Solution
- Kotlin Exercises practice with solution
- MongoDB Exercises, Practice, Solution
- SQL Exercises, Practice, Solution - JOINS
- Java Basic Programming Exercises
- SQL Subqueries
- Adventureworks Database Exercises
- C# Sharp Basic Exercises
- SQL COUNT() with distinct
- Java Collection Exercises
- SQL COUNT() function
- SQL Inner Join