mysql AUTO_INCREMENT

来源:互联网 发布:人工智能研发企业 编辑:程序博客网 时间:2024/05/21 17:09
mysql> CREATE TABLE test    -> (    -> id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,    -> username VARCHAR(15) NOT NULL    -> )AUTO_INCREMENT = 100;Query OK, 0 rows affected (0.07 sec)mysql> show create table test\G;*************************** 1. row ***************************       Table: testCreate Table: CREATE TABLE `test` (  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,  `username` varchar(15) NOT NULL,  PRIMARY KEY (`id`)) ENGINE=InnoDB AUTO_INCREMENT=100 DEFAULT CHARSET=utf81 row in set (0.00 sec)ERROR: No query specifiedmysql> insert into test(username) values('aaa');Query OK, 1 row affected (0.01 sec)mysql> select * from test;+-----+----------+| id  | username |+-----+----------+| 100 | aaa      |+-----+----------+1 row in set (0.00 sec)mysql>  insert into test(username) values('bbb');Query OK, 1 row affected (0.01 sec)mysql> select * from test;+-----+----------+| id  | username |+-----+----------+| 100 | aaa      || 101 | bbb      |+-----+----------+2 rows in set (0.00 sec)

0 0
原创粉丝点击