博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
sql中len函数_在SQL中使用LEN(),ROUND()函数
阅读量:2535 次
发布时间:2019-05-11

本文共 1656 字,大约阅读时间需要 5 分钟。

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中其他标量函数的不同或使用。 祝你有美好的一天! 学习愉快!

翻译自:

sql中len函数

转载地址:http://vcvzd.baihongyu.com/

你可能感兴趣的文章
生成商户订单号/退款单号
查看>>
使用Android OpenGL ES 2.0绘图之六:响应触摸事件
查看>>
我们过去几年做对了哪些事
查看>>
Java Bigdecimal使用
查看>>
SQL注入之绕过WAF和Filter
查看>>
jquery validate使用方法
查看>>
DataNode 工作机制
查看>>
windows系统下安装MySQL
查看>>
实验二+070+胡阳洋
查看>>
Linux IPC实践(3) --具名FIFO
查看>>
Qt之模拟时钟
查看>>
第一次接触安卓--记于2015.8.21
查看>>
(转)在分层架构下寻找java web漏洞
查看>>
C++ ifstream ofstream
查看>>
跟初学者学习IbatisNet第四篇
查看>>
seL4环境配置
查看>>
Git报错:insufficient permission for adding an object to repository database .git/objects
查看>>
ajax跨域,携带cookie
查看>>
阶段3 2.Spring_01.Spring框架简介_03.spring概述
查看>>
阶段3 2.Spring_02.程序间耦合_1 编写jdbc的工程代码用于分析程序的耦合
查看>>