I have a database with hundreds of tables I bring just an example this is my database That's how it looks : my table call stuff That is how the table looks
id name
1 001
2 002
3 003
Now I have an update that I just want to update After table 3 Because a different computer is created not the server
INSERT INTO `stuff` VALUES (1, '004');
INSERT INTO `stuff` VALUES (2, '005');
I currently have 2 backups
stuff1.sql AND stuff2.sql
My question is with a possible update table without starting to number it in order
I could have done it like this :
INSERT INTO `stuff` VALUES (1, '001');
INSERT INTO `stuff` VALUES (2, '002');
INSERT INTO `stuff` VALUES (3, '003');
INSERT INTO `stuff` VALUES (4, '004');
INSERT INTO `stuff` VALUES (5, '005');
But what do you do when there are many tables?
Use id as auto increment and do this
INSERT INTO `stuff` (`name`) VALUES ('001');
and now it insert row with next id.
Hope this help.
try to write this in 'DDL' before insert the data :
[column_name] Integer- primary key - autoincremen ,
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.