//flex table opened by JP

Click to See Complete Forum and Search --> : MySQL truncate question


nothing
09-07-2005, 10:02 PM
Let's say I have a table called foo and it has two columns: id and name. Column id is the primary key and set to auto-increment. Now let's say I add two names to the table: foo and bar. It would look something like this:
1 foo
2 bar

For some reason, I needed to delete all the data from table foo, so I issued a truncate command. Table foo is good to go again and I add the name nothing to it. Here's how it looks:
3 nothing

Why id is 3 if nothing is the first name on the table? Is this a bug or something? Does anyone know a way of fixing this? Thanks a lot.

CompGeek01
09-08-2005, 11:17 AM
ALTER TABLE thetable AUTO_INCREMENT = 0;