9、mysql中auto_increment的简单使用
2011-11-11 14:51
309 查看
1、auto_increment的复位
ALTER TABLE your_table_name AUTO_INCREMENT = 1
2、The AUTO_INCREMENT attribute can be used to generate a unique identity for new rows。示例:
CREATE TABLE animals (
id MEDIUMINT NOT NULL AUTO_INCREMENT,
name CHAR(30) NOT NULL,
PRIMARY KEY (id)
) ENGINE=MyISAM;
INSERT INTO animals (name) VALUES
('dog'),('cat'),('penguin'),
('lax'),('whale'),('ostrich');
3、No value was specified for the AUTO_INCREMENT column, so MySQL assigned sequence numbers automatically. You can also explicitly assign NULL or 0 to the column to generate sequence numbers.
参考
【1】 关于auto_increment的一个应用讨论
http://www.iteye.com/topic/198779
【2】 mysql官网
http://www.w3school.com.cn/sql/sql_datatypes.asp
http://dev.mysql.com/doc/refman/5.0/en/example-auto-increment.html
http://dev.mysql.com/doc/refman/5.1/zh/column-types.html#numeric-type-overview
【3】 使用auto_increment经验总结
http://www.frostsky.com/2011/04/mysql-auto_increment-2/
【4】 总结的不错
http://www.bhcode.net/article/20090219/4161.html
ALTER TABLE your_table_name AUTO_INCREMENT = 1
2、The AUTO_INCREMENT attribute can be used to generate a unique identity for new rows。示例:
CREATE TABLE animals (
id MEDIUMINT NOT NULL AUTO_INCREMENT,
name CHAR(30) NOT NULL,
PRIMARY KEY (id)
) ENGINE=MyISAM;
INSERT INTO animals (name) VALUES
('dog'),('cat'),('penguin'),
('lax'),('whale'),('ostrich');
3、No value was specified for the AUTO_INCREMENT column, so MySQL assigned sequence numbers automatically. You can also explicitly assign NULL or 0 to the column to generate sequence numbers.
参考
【1】 关于auto_increment的一个应用讨论
http://www.iteye.com/topic/198779
【2】 mysql官网
http://www.w3school.com.cn/sql/sql_datatypes.asp
http://dev.mysql.com/doc/refman/5.0/en/example-auto-increment.html
http://dev.mysql.com/doc/refman/5.1/zh/column-types.html#numeric-type-overview
【3】 使用auto_increment经验总结
http://www.frostsky.com/2011/04/mysql-auto_increment-2/
【4】 总结的不错
http://www.bhcode.net/article/20090219/4161.html
相关文章推荐
- MyBatis 3 中,使用MySql 的AUTO_INCREMENT
- zerofill在mysql字段定义中的使用以及auto_increment的注意事项
- MySQL - 使用AUTO_INCREMENT
- AUTO_INCREMENT在MySQL的使用
- MySQL 序列使用AUTO_INCREMENT
- PowerDesigner 使用 MySQL 的 auto_increment
- MySQL 使用方法简单教程
- mysql 简单使用
- mysql中unique key与auto_increment的性能分析
- Mysql的使用 -简单的索引
- jquery.autocomplete.js的简单使用
- 【MySQL基础】MySQL关于load对auto_increment字段的影响
- 使用MySQL-zrm对Mysql简单配置以备份&&恢复操作步骤
- 重置 MySQL 自增列 AUTO_INCREMENT 初时值
- mysql AUTO_INCREMENT 设置主键自增
- mysql create table primary key auto_increment
- mysql 索引的简单使用
- Linux系统下Mysql使用简单教程(一)
- Mysql使用简单教程(二)
- mysql 视图的简单使用