首页 > 数据库技术 > 详细

MySql自增长列

时间:2015-03-27 17:00:25      阅读:241      评论:0      收藏:0      [点我收藏+]

1. 关键字

   auto_increment

2. 自增用法

   a) create table test(tid int auto_increment, tname varchar(10), primary key(tid));

   b) create table test(tid int auto_increment, tname varchar(10), primary key(tid)) auto_increment=10; 可以指定自增列的初始值

3. 获得当前自增列的值

   select @@identity;

4. 插入新值

   insert into test values(@identity, ‘小明‘);

MySql自增长列

原文:http://www.cnblogs.com/eagle-xie/p/4371859.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!