问题描述
CREATE TABLE IF NOT EXISTS `qdz76_piteachers` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`teacher_name` varchar(250) NOT NULL,
`teacher_alias` varchar(250) NOT NULL,
`teacher_role` varchar(50) NOT NULL,
`image_folderlrg` int(11) NOT NULL,
`teacher_image_lrg` varchar(250) NOT NULL,
`teacher_email` varchar(100) NOT NULL,
`teacher_website` varchar(250) NOT NULL,
`teacher_description` text NOT NULL,
`published` tinyint(3) NOT NULL,
`ordering` int(11) NOT NULL,
`teacher_view` tinyint(3) NOT NULL,
`checked_out` tinyint(1) NOT NULL DEFAULT '0',
`checked_out_time` datetime DEFAULT NULL,
`user` int(11) NOT NULL,
`language` char(7) NOT NULL DEFAULT '*',
`featured` tinyint(3) NOT NULL DEFAULT '0',
`metakey` text NOT NULL,
`metadesc` text NOT NULL,
`lastname` varchar(250) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=30 ;
我对mysql很陌生,并且已阅读此页面 http ://dev.mysql.com/doc/refman/5.5/en/create-table.html ,看起来AUTO_INCREMENT = 30
在table_option
部分中,但我仍然不明白这里是指.这是否意味着所有int字段的auto_increment均为30?
I am very new to mysql and have read this page http://dev.mysql.com/doc/refman/5.5/en/create-table.html, it looks like AUTO_INCREMENT = 30
is in table_option
section, but I still don't understand what AUTO_INCREMENT = 30
here means. Does it mean all int fields have auto_increment as 30?
推荐答案
实际上,每当您从服务器准备转储或从phpmyadmin获取表结构时,它都会根据现有表值为您提供auto_increment值,因此您将获得它作为30.
Actually whenever you prepare a dump from server or get table structure from phpmyadmin then it provide you auto_increment value as per existing table values, so you will be getting it as 30.
无论何时创建新表,都无需提及auto_increment(如果没有特定原因),因为它会自动从1开始.
Whenever you create new table, then no need to mention auto_increment (if there is no specific reason) as it automatically start from 1.
出于某些特定原因,您需要告诉mysql我的auto_increment值应从该数字开始,在这种情况下,您需要在表创建语法中指定它.
In some specific reason you need to tell mysql that my auto_increment value should start from this number in this case you need to specify it in your table creation syntax.
这篇关于创建表时将auto_increment设置为30的目的是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!