<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1020800" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1020800</link>
    <description></description>
    <language>en</language>
          <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/resetting-next-row-autoindex#comment-1167663</link>
    <description> &lt;p&gt;Hi mijator, Welcome to TWF.&lt;br /&gt;
This is a very old post, you should really start your own thread asking your question.&lt;/p&gt;
&lt;p&gt;Quick answer: not defrag but you can write a script which takes all the info into an array, clears the database row then reinstall the info, if you have an auto increment index the numbers will start at 1 again.&lt;br /&gt;
There is no real need to do this however as the info, if sorted by a loop will display the results sequential anyway.&lt;/p&gt;
 </description>
     <pubDate>Fri, 11 Mar 2005 09:44:00 +0000</pubDate>
 <dc:creator>Busy</dc:creator>
 <guid isPermaLink="false">comment 1167663 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>resetting autoindex with phpMyadmin</title>
    <link>https://www.webmaster-forums.net/web-database-development/resetting-next-row-autoindex#comment-1167634</link>
    <description> &lt;p&gt;It is possible...had to do it recently...&lt;/p&gt;
&lt;p&gt;It kept bugging me that when a row gets deleted the autoindex increments anyways (instead of filling the lowest number, it proceeds from where it last left off)...it&#039;s probably safer this way (as a way to ensure the index is unique and not being used anywhere else), but it ends up making datafiles hard to read because the index numbers jump around (i.e., are not in sequential order)...&lt;/p&gt;
&lt;p&gt;At any rate, the way to get phpMyadmin to reset the autoindex to the lowest number available, go to the &quot;Structure&quot; page, then click on &quot;Operations&quot; and then click on &quot;Defragment Table&quot;.  You can check to see that it worked by going back to the Structure page and looking for the box/line that says &quot;Next Autoindex&quot; under &quot;Row Statistic&quot;.&lt;/p&gt;
&lt;p&gt;I&#039;d like to be able to defragment each time I do a delete on a table, so that my index numbers remain sequential - does anyone know how to do that?&lt;/p&gt;
&lt;p&gt;Thx,&lt;/p&gt;
&lt;p&gt;Mij&lt;/p&gt;
 </description>
     <pubDate>Thu, 10 Mar 2005 23:29:29 +0000</pubDate>
 <dc:creator>mijator</dc:creator>
 <guid isPermaLink="false">comment 1167634 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/resetting-next-row-autoindex#comment-1128497</link>
    <description> &lt;p&gt;There is no wildcard because you can&#039;t delete a single field from a recordset.  That would be an UPDATE query setting the field to NULL.&lt;/p&gt;
 </description>
     <pubDate>Fri, 04 Apr 2003 20:02:49 +0000</pubDate>
 <dc:creator>Mark Hensler</dc:creator>
 <guid isPermaLink="false">comment 1128497 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/resetting-next-row-autoindex#comment-1128481</link>
    <description> &lt;p&gt;You do need to be careful. If you have tables linked you need to make sure that you delete the data in the other tables or you data will get very mixed up.&lt;/p&gt;
&lt;p&gt;Things to ponder:&lt;br /&gt;
Why is it:&lt;br /&gt;
&lt;strong&gt;SELECT * from tablename&lt;/strong&gt;&lt;br /&gt;
and&lt;br /&gt;
&lt;strong&gt;DELETE from tablename&lt;/strong&gt;&lt;br /&gt;
It seems that it should be:&lt;br /&gt;
&lt;strong&gt;DELETE * from tablename&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I have typed that one in a few times.&lt;/p&gt;
 </description>
     <pubDate>Fri, 04 Apr 2003 15:26:42 +0000</pubDate>
 <dc:creator>mairving</dc:creator>
 <guid isPermaLink="false">comment 1128481 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/resetting-next-row-autoindex#comment-1128476</link>
    <description> &lt;p&gt;Yep &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/big.png&quot; title=&quot;Laughing out loud&quot; alt=&quot;Laughing out loud&quot; class=&quot;smiley-content&quot; /&gt;&lt;/p&gt;
 </description>
     <pubDate>Fri, 04 Apr 2003 13:35:00 +0000</pubDate>
 <dc:creator>nuk3</dc:creator>
 <guid isPermaLink="false">comment 1128476 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/resetting-next-row-autoindex#comment-1128395</link>
    <description> &lt;p&gt;oh, in that case simply &quot;DELETE FROM tablename;&quot; will empty the table and reset the counters&lt;/p&gt;
 </description>
     <pubDate>Thu, 03 Apr 2003 09:51:18 +0000</pubDate>
 <dc:creator>ROB</dc:creator>
 <guid isPermaLink="false">comment 1128395 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/resetting-next-row-autoindex#comment-1128387</link>
    <description> &lt;p&gt;I did it on a table with no data in it. I just wanted to know how to do it so that if there are no records in the table and a user goes to add in info the auto increment value will be reset to 1. This could be the case after 13 entries (13 altogether) are deleted..&lt;/p&gt;
 </description>
     <pubDate>Thu, 03 Apr 2003 07:37:41 +0000</pubDate>
 <dc:creator>nuk3</dc:creator>
 <guid isPermaLink="false">comment 1128387 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/resetting-next-row-autoindex#comment-1128273</link>
    <description> &lt;p&gt;typically you dont want to reset the auto increment though as it provides a logical order to your records, unless you empty the table.  emptying the table (DELETE FROM tablename) will reset the incrementer to zero.&lt;/p&gt;
&lt;p&gt;resetting it manually with existing records, i assume, would be smart enough to skip existing id&#039;s, but dont count on your id&#039;s to have any meaning. (for example why would user id 3 who joined today come before user id 20 who joined 3 years ago?)&lt;/p&gt;
 </description>
     <pubDate>Tue, 01 Apr 2003 21:30:10 +0000</pubDate>
 <dc:creator>ROB</dc:creator>
 <guid isPermaLink="false">comment 1128273 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/resetting-next-row-autoindex#comment-1127675</link>
    <description> &lt;p&gt;Thanks allot Mark &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/wink.png&quot; title=&quot;Wink&quot; alt=&quot;Wink&quot; class=&quot;smiley-content&quot; /&gt;&lt;/p&gt;
 </description>
     <pubDate>Sat, 22 Mar 2003 08:49:55 +0000</pubDate>
 <dc:creator>nuk3</dc:creator>
 <guid isPermaLink="false">comment 1127675 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/resetting-next-row-autoindex#comment-1127674</link>
    <description> &lt;p&gt;hehe.. maybe I should do more research before answering next time.  Took only 30 seconds to find the answer via the search at mysql.com&lt;/p&gt;
&lt;p&gt;&quot;ALTER TABLE tbl_name AUTO_INCREMENT = 1;&quot;&lt;/p&gt;
&lt;p&gt;It was in the user comments, not in the official docs.&lt;/p&gt;
 </description>
     <pubDate>Sat, 22 Mar 2003 08:46:09 +0000</pubDate>
 <dc:creator>Mark Hensler</dc:creator>
 <guid isPermaLink="false">comment 1127674 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
