'CREATE TABLE `test` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  
`price` float(7,6) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ;
insert into test(price) values (535.566);提示out of range !!!不是说7个整数,6个小数吗?你看我的是什么东西?535.566!!!! 怎么就无法插入嗯?

解决方案 »

  1.   

    DOUBLE[(M,D)] M is the total number of digits 
    D is the number of digits following the decimal point
    所以整数部分就是7-6=1位
      

  2.   

    问题已经解决了,不过有新问题:'test', 'CREATE TABLE `test` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `price` float(12,4) NOT NULL,
      PRIMARY KEY (`id`)
    ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8'
    alter table test  alter column price decimal(13,6);  //error ,这是一行代码,我在mysql 的gui里面执行的
      

  3.   

    float(m,n) m表示总的位数,包括小数点、???
      

  4.   


    ...........alter table test  alter column price decimal(13,6);  //error ,这是一行代码,我在mysql 的gui里面执行的
    [/code]错误提示是什么? 提问时请一同贴出错误提示及它信息以便他人分析。
    问题说明越详细,回答也会越准确!参见如何提问。(提问的智慧
      

  5.   


    ...........alter table test  alter column price decimal(13,6);  //error ,这是一行代码,我在mysql 的gui里面执行的
    [/code]错误提示是什么? 提问时请一同贴出错误提示及它信息以便他人分析。
    问题说明越详细,回答也会越准确!参见如何提问。(提问的智慧
    error:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'decimal(13,6)' at line 1
      

  6.   

    float(m,n) m表示总的位数,包括小数点、???不包括吧?
      

  7.   

    float(m,n) m表示总的位数,包括小数点、???不包括吧? 

    测试了一下,应该是不包括小数点的。但是float(m,n)小数点后面n位,整数不封m-n,小数点后面不足会自动补充
      

  8.   

    float(m,n) m表示总的位数,包括小数点、???不包括吧? 

    测试了一下,应该是不包括小数点的。但是float(m,n)小数点后面n位,整数不封m-n,小数点后面不足会自动补充在不?什么叫 整数不封m-n?看不懂,求解释