您好,欢迎来到舟格财经。
搜索
您的当前位置:首页Mysql,SqlServer,Oracle主键自动增长的设置_MySQL

Mysql,SqlServer,Oracle主键自动增长的设置_MySQL

来源:舟格财经


bitsCN.com

参考文献

http://blog.csdn.net/andyelvis/article/details/2446865

1、把主键定义为自动增长标识符类型

MySql

在mysql中,如果把表的主键设为auto_increment类型,数据库就会自动为主键赋值。例如:

create table customers(id int auto_increment primary key not null, name varchar(15));insert into customers(name) values("name1"),("name2");select id from customers;
bitsCN.com

Copyright © 2019- zougedi.com 版权所有

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务