mysql向数据库插入小数,变成了整数,

导致这个问题的原因是:

在设计表的时候,得定义表字段小数点的位数;

mysql向数据库插入小数,变成了整数,解决方案

 示例sql语句:

mysql> create table MyClass(
    > id int(4) not null primary key auto_increment,
    > name char(20) not null,
    > sex int(4) not null default '0',
    > degree double(16,2));

double(16,2) 16位长度,小数点后2位。

相关文章:

  • 2021-11-26
  • 2021-11-08
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-06
  • 2021-08-20
  • 2021-11-20
猜你喜欢
  • 2023-04-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-10
  • 2021-12-19
  • 2022-12-23
相关资源
相似解决方案