【www.gdgbn.com--php入门】
sql入门教程:SQL ROUND() 实例教程
round ( )函数
round ( )函数是用来一轮数字领域的一些具体小数。
数据库round ( )语法
SELECT ROUND(column_name,decimals) FROM table_name
好下面我们来看看数据结构
Parameter Description column_nameRequired. The field to round.decimalsRequired. Specifies the number of decimals to be returned.
实例教程.
Id ProductName Unit UnitPrice 1Jarlsberg1000 g10.452Mascarpone1000 g32.563Gorgonzola1000 g15.67
现在,我们要显示产品名称和价格四舍五入至最接近的整数。
我们使用下面的SELECT语句:SELECT ProductName, ROUND(UnitPrice,0) as UnitPrice FROM Persons输出结果.ProductName UnitPrice Jarlsberg10Mascarpone33Gorgonzola16