A function module in the project used a scalar value function, and the function of the ceiling () function of the use of their own to find some information, the SQL of these functions to make a simple record, to facilitate their own learning. There are shortcomings welcome to make bricks Supplement
The 1.round () function follows the rounding principle, which is used to round a numeric field to a specified number of decimal digits
The 2.floor (value) function returns the smallest integer less than or equal to the specified value (value)
The 3.ceiling (value) function returns the smallest integer greater than or equal to the specified value (value)
For example: for 12.9,floor (12.9) return 12;ceiling (12.9) return 13;round (12.9,0) return 13
Where the standard usage of the round () function is:
Select round from table_name
SQL instance: There is a Products table
Now, round the price to the nearest integer.
Select ProductName,round(UnitPrice,0 as from products
The results are as follows:
This is a self-made record, convenient for later study.
Analysis of round (), floor (), Ceiling () function in SQL