mysql自增主键
MariaDB [test]> create table test1(id int primary key auto_increment,name varchar(20))auto_increment=1; #id為自增主鍵,默認從1開始遞增
Query OK, 0 rows affected (0.07 sec)MariaDB [test]> insert into test1 values(null,'linux'); #注意,需要null,否則列數不對應mysql會報錯
Query OK, 1 row affected (0.01 sec)MariaDB [test]> insert into test1 values(null,'linux2');
Query OK, 1 row affected (0.00 sec)MariaDB [test]> insert into test1 values(null,'linux3');
Query OK, 1 row affected (0.00 sec)MariaDB [test]> select * from test1;
+----+--------+
| id | name |
+----+--------+
| 1 | linux |
| 2 | linux2 |
| 3 | linux3 |
+----+--------+
3 rows in set (0.05 sec)MariaDB [test]>
轉載于:https://www.cnblogs.com/biaopei/p/7730510.html
總結
- 上一篇: 基于容器的全链路运维平台实践
- 下一篇: odoo开发笔记:前端显示强制换行