id int not null auto_increment和
id int(11) not null auto_increment有什么分别?为什么需要指定 int(11) 为11个呢,
这个id 作为主键,让他自动增加了还要 int(11),这样有什么好处么?

解决方案 »

  1.   

    没有区别。int(11)只是让它显示11个字符而已。存储的数据一样。
      

  2.   

    http://www.phpchina.com/viewthread_9971.html
      

  3.   

    基本上是没有区别的int是整型,(11)是指显示字符的长度,但要加参数的,最大为255,比如它是记录行数的id,插入10笔资料,它就显示00000000001 ~~~00000000010,当字符的位数超过11,它也只显示11位,如果你没有加那个让它未满11位就前面加0的参数,它不会在前面加0