浮点型

作用:存储身高、体重、薪资
分类:
float (*****)
double (**)
decimal (**)

测试:
#相同点
#1、对于三者来说,都能存放30位小数,
#不同点:
1、精度的排序从低到高:float,double,decimal
2、float与double类型能存放的整数位比decimal更多


create table t9(x float(255,30));
create table t10(x double(255,30));
create table t11(x decimal(65,30));

insert into t9 values(1.111111111111111111111111111111);
insert into t10 values(1.111111111111111111111111111111);
insert into t11 values(1.111111111111111111111111111111);


mysql> select * from t9;
+----------------------------------+
| x |
+----------------------------------+
| 1.111111164093017600000000000000 |
+----------------------------------+
1 row in set (0.00 sec)

mysql> select * from t10;
+----------------------------------+
| x |
+----------------------------------+
| 1.111111111111111200000000000000 |
+----------------------------------+
1 row in set (0.00 sec)

mysql> select * from t11;
+----------------------------------+
| x |
+----------------------------------+
| 1.111111111111111111111111111111 |
+----------------------------------+
1 row in set (0.00 sec)
posted @ 2018-09-22 21:34  不沉之月  阅读(178)  评论(0编辑  收藏  举报