webguync Posted June 19, 2008 Share Posted June 19, 2008 Say you have a table with a field called ID set as Type(smallint), and set to auto increment. You have 10 entries, 1-10 in the ID field. You delete the entries, and start adding new ones. Even though there are currently no entries, the new additions will begin 11,12,13,14,15, and so on for the ID's. Is there a way to get the ID's to start over at 1 without manually going in to edit each one? Link to comment https://forums.phpfreaks.com/topic/110962-solved-question-about-auto-increment-in-mysql/ Share on other sites More sharing options...
fenway Posted June 19, 2008 Share Posted June 19, 2008 Say you have a table with a field called ID set as Type(smallint), and set to auto increment. You have 10 entries, 1-10 in the ID field. You delete the entries, and start adding new ones. Even though there are currently no entries, the new additions will begin 11,12,13,14,15, and so on for the ID's. Is there a way to get the ID's to start over at 1 without manually going in to edit each one? Why does everyone want to do this? This is NOT a counter. This is a unique row identifier -- never to be re-used. Oh, and you'll kick yourself later for using SMALLINT -- use UNSIGNED INT instead. Link to comment https://forums.phpfreaks.com/topic/110962-solved-question-about-auto-increment-in-mysql/#findComment-569382 Share on other sites More sharing options...
webguync Posted June 19, 2008 Author Share Posted June 19, 2008 I don;t see an option for UNSIGNED INT. What is the advantage of using that? Link to comment https://forums.phpfreaks.com/topic/110962-solved-question-about-auto-increment-in-mysql/#findComment-569396 Share on other sites More sharing options...
Barand Posted June 19, 2008 Share Posted June 19, 2008 In round numbers [pre] +----------------+---------------+ | ID TYPE | MAX ROWS | +----------------+---------------+ | SMALLINT | 32,000 | | UNSIGNED INT | 4,000,000,000 | +----------------+---------------+ Link to comment https://forums.phpfreaks.com/topic/110962-solved-question-about-auto-increment-in-mysql/#findComment-569420 Share on other sites More sharing options...
webguync Posted June 20, 2008 Author Share Posted June 20, 2008 is UNSIGNED INT something new? I am not seeing that option in my version of PHPMYAdmin Link to comment https://forums.phpfreaks.com/topic/110962-solved-question-about-auto-increment-in-mysql/#findComment-570221 Share on other sites More sharing options...
fenway Posted June 20, 2008 Share Posted June 20, 2008 is UNSIGNED INT something new? I am not seeing that option in my version of PHPMYAdmin Um, no. Specify "INT", and then UNSIGNED somewhere. Link to comment https://forums.phpfreaks.com/topic/110962-solved-question-about-auto-increment-in-mysql/#findComment-570267 Share on other sites More sharing options...
webguync Posted June 20, 2008 Author Share Posted June 20, 2008 oh, in the attributes. I see, thanks Link to comment https://forums.phpfreaks.com/topic/110962-solved-question-about-auto-increment-in-mysql/#findComment-570271 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.