数据库中float,double与decimal的区别
来源:互联网 发布:led通用编辑软件 编辑:程序博客网 时间:2024/06/11 23:43
1.Decimal 数据包含存储在最小有效数上的数据。在 SQL Server中,小数数据使用 decimal 或 numeric 数据类型存储。存储 decimal 或 numeric 数值所需的字节数取决于该数据的数字总数和小数点右边的小数位数。2.decimal(18,4),decimal(19,1),两者能保存的整数位和小数位不同.
create table tb(val1 decimal(18,4) , val2 decimal(19,1))go insert into tb values(1234567890123.1234 , 12345678901234567.1) select * from tb drop table tb /*val1 val2 -------------------- --------------------- 1234567890123.1234 12345678901234567.1 (所影响的行数为 1 行)*/
精度不同,一个是小数点后面精确4位,一个是精确1位
注意的是decimal(18,4)总长18位,包括1位小数点和4为小数,也就是说18-1-4=13整数位只有13位
decimal(19,1)总长19位,17位整数,1位小数
注意float与double数据类型储存的是近似值,而decimal是字符串
2 0
- 数据库中float,double与decimal的区别
- Sql中decimal、float、double类型的区别与用法
- c#中decimal ,double,float的区别
- c#中decimal ,double,float的区别
- C#中decimal, double, float的区别
- c#中decimal ,double,float的区别
- c#中decimal ,double,float的区别
- c#中decimal ,double,float的区别
- c#中decimal ,double,float的区别
- c#中decimal ,double,float的区别
- c#中decimal ,double,float的区别
- decimal ,double,float的区别
- mysql中decimal,numeric,double,float的区别
- MySQL中decimal与float的区别
- decimal,float和double的区别
- float,double,decimal的区别于误解
- decimal,float和double的区别
- decimal,float和double的区别
- android用户特权管理思路
- oracle中逗号分割值
- Android实战开发:自定义照相机
- Maven搭建SpringMVC+Mybatis项目详解
- 使用xib封装一个自定义view的步骤
- 数据库中float,double与decimal的区别
- p243 第二题
- app 通知类接口设计
- 分布式关系数据库中间件swiftdb (类似mycat、cobar中间件)
- PHP递归遍历多维数组
- HDFS 基础
- FFmpeg在iOS上完美编译
- 消息转发原理浅析
- 需求分析说明书和需求规格说明书的区别