lundi 2 mars 2015

Big difference between id value


I have this database table where I insert multiple results during 1 action. In php I have a submit button when pressed, inserts 1-50 rows(depending on the user input). I've got a foreign key in this table which has the same value on the rows inserted during that action(so when the primary key connected to the foreign key gets deleted, the 1-50 rows will be deleted as well). Now I've got an Auto Increment in my table and during testing, I find out that the ID's are somewhat like this: 1,2,3,200,249,460,670. So like huge differences between the ID's. Whenever I would create a new row, it will get the ID 671. I feel like it would be better if the ID would just get 4 in this case. Is there any way of doing this automatically and not typing ALTER TABLE users AUTO_INCREMENT=4; manually? If so, are there any advantages/disadvantages?





Aucun commentaire:

Enregistrer un commentaire