CREATE TABLE `table1` (
  `id` int(6) unsigned NOT NULL auto_increment,
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB DEFAULT

解决方案 »

  1.   

    bi必须是int的一种,才可以,然auto_increment
      

  2.   

    auto_increment是自动增加,我要随机编号
      

  3.   

    你建个无重复的索引。默认值设置为rand()。mysql> select rand();
    +------------------+
    | rand()           |
    +------------------+
    | 0.76868359164212 |
    +------------------+
    1 row in set (0.07 sec)mysql> select rand();
    +------------------+
    | rand()           |
    +------------------+
    | 0.76691954374958 |
    +------------------+
    1 row in set (0.00 sec)mysql>