Analysis of the Round (), Floor (), Ceiling () functions in SQL, and roundceiling
A scalar value function is used in a function module of the project, and the function has the usage of the ceiling () function. I found some information and made a simple record of these functions in SQL, easy to learn. If you have any shortcomings, please click here.
1. The round () function follows the rounding principle and is used to round a value field to a specified decimal place.
2. The floor (value) function returns the smallest integer less than or equal to the specified value.
3. The ceiling (value) function returns the smallest integer greater than or equal to the specified value.
For example, for 12.9, floor (12.9) returns 12; ceiling (12.9) returns 13; round (12.9, 0) returns 13
Standard usage of the round () function:
Select round (column_name, decimals) from table_name
SQL instance: There is a Products table
Now, round the price to the nearest integer.
Select ProductName, round (UnitPrice, 0) as UnitPrice from Products
The result is as follows:
This is a record made by myself for future study.