MySql中的自动编号

在MySql中创建表:

mysql> create table test(
    -> id int not null primary key auto_increment, //ID 为自动编号
    -> name varchar(20)
    -> );
Query OK, 0 rows affected (0.49 sec)


插入数据:

mysql> insert into test(name)
    -> values('hello');
Query OK, 1 row affected (0.14 sec)

mysql> select * from test;
+----+-------+
| id | name  |
+----+-------+
|  1 | hello |
+----+-------+
1 row in set (0.01 sec)

猜你喜欢

转载自rm1152001460.iteye.com/blog/1705017
今日推荐