简体   繁体   English

表模式中AUTO_INCREMENT = 20018215的含义是什么

[英]What is the meaning of AUTO_INCREMENT=20018215 here in table schema

CREATE TABLE `tblspmaster` (
  `CSN` bigint(20) NOT NULL AUTO_INCREMENT,
  `SP` varchar(50) NOT NULL,
  `FileImportedDate` date NOT NULL,
  `AMZFileName` varchar(580) NOT NULL,
  `CasperBatch` varchar(50) NOT NULL,
  `BatchProcessedDate` date NOT NULL,
  `ExpiryDate` date NOT NULL,
  `Region` varchar(50) NOT NULL,
  `FCCity` varchar(50) NOT NULL,
  `VendorID` int(11) NOT NULL,
  `LocationID` int(11) NOT NULL,
  PRIMARY KEY (`CSN`)
) ENGINE=InnoDB AUTO_INCREMENT=20018215 DEFAULT CHARSET=latin1;

What is the meaning of AUTO_INCREMENT=20018215 here in table schema . 表模式中的AUTO_INCREMENT = 20018215的含义是什么? as i am inserting 500k records my identity is OK from 1 to 500k but when i tried to insert next 500k records, next records identity column value is 524281 instead of 500001 . 当我插入500k记录时,我的身份从1到500k是可以的,但是当我尝试插入下一个500k记录时,下一个记录的身份列值是524281而不是500001

这意味着(自动分配给CSN )第一个值是20018215

The large initial value, 20018215, was probably the previous value of the auto increment when you did a "Send to SQL Editor" -> "Create Statement" menu selection in MySQL Workbench. 当您在MySQL Workbench中选择“发送到SQL编辑器”->“创建语句”菜单时,较大的初始值20018215可能是自动增量的先前值。 This is just a safe value to skip over existing data just in case you have to reimport the previous records. 如果您必须重新导入以前的记录,这只是跳过现有数据的安全值。

I had the same question, but after generating several "Create" edit templates from known tables, I noticed the AUTO_INCREMENT value corresponded to the quantity of existing records in those tables. 我有同样的问题,但是在从已知表中生成几个“创建”编辑模板后,我注意到AUTO_INCREMENT值对应于那些表中现有记录的数量。 I removed the large values from my templates since I want my new tables to begin with a primary key = 1. 我希望从我的模板中删除较大的值,因为我希望新表以主键= 1开头。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM