sql中len函数
LEN() and ROUND() are scalar functions which return a single value, based in the input value.
LEN()和ROUND()是标量函数,它们基于输入值返回单个值。
LEN() function is used to find the length of the value in any field.
LEN()函数用于在任何字段中查找值的长度。
SYNTAX:
句法:
SELECT LEN(column_name) FROM table_name;
ROUND() function is used for Rounds a numeric field to the number of decimals specified.
ROUND()函数用于将数字字段四舍五入为指定的小数位数。
TABLE:
表:

SYNTAX:
句法:
SELECT ROUND(column_name,decimals) FROM table_name;
Column name and decimal parameter is required to round with specific number of decimal to be returned.
要返回特定的十进制数,必须使用列名和十进制参数进行四舍五入。
Example:
例:

NOTE: As you all know that different database systems ensure passing differently than you might imagine. When rounding a number with a fractional part to an integer, we round any number .1 through .4 DOWN to the next lower integer and .5 through .9 UP to the next higher integer. Many database systems have adopted the IEEE 754 standard for arithmetic operations, so the default rounding behavior is "round half to even." In this scheme, .5 is rounded to the next even integer. So, both 1.5 and 2.5 would be rounded to 2.
注意:众所周知,不同的数据库系统确保传递的方式与您想象的不同。 将带小数部分的数字四舍五入为整数时,我们将.1到.4 DOWN的数字四舍五入到下一个较低的整数,将.5到.9 UP的数字四舍五入到下一个较高的整数。 许多数据库系统已经对算术运算采用了IEEE 754标准,因此默认的舍入行为是“一半舍入为偶数”。 在此方案中,.5会四舍五入到下一个偶数整数。 因此,将1.5和2.5都舍入为2。
Conclusion:
结论:
In this article, we have learn how to use LEN(), ROUND() functions in SQL and SQL queries? We will know more about different or use of another scalar function in SQL. Have a great day! Happy Learning!
在本文中,我们学习了如何在SQL和SQL查询中使用LEN(),ROUND()函数 ? 我们将更多地了解SQL中其他标量函数的不同或使用。 祝你有美好的一天! 学习愉快!
翻译自: https://www.includehelp.com/sql/Use-of-LEN-ROUND-functions.aspx
sql中len函数