sql中len函数_在SQL中使用LEN(),ROUND()函数

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:

表:

table example for len() and round() in sql

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:

例:

round() in sql query

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函数

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值