On Sat, Apr 26, 2003 at 05:16:32PM -0500, Erik V. Anderson wrote:
> Quoting "John J. Trammell" <trammell+tclug at el-swifto.com>:
> > If you delete all the entries from the table, your next insert
> > will start with id "1".
> 
> I don't think this is true...I actually tried that once, and it kept 
> incrementing from where it left off...
> 

It could be one of those things that varies from table type
to table type.  I just tried it with a MyISAM table, mysql
3.23.49 (I know, I'm behind :), and that's how it worked.

I also see an interesting thing--a delete statement like
"delete from foo where id > 0" does *not* reset the counter,
and the next insert "remembers" the next increment value.

But if you do a "delete from foo", the counter is reset.
This is odd to me, because both deletes remove all records
from the table.  There must be something special about 
a delete without a "where".  Perhaps that is what you saw?

One more thing--the MySQL documentation mentions that the
last_insert value can be tweaked via the ALTER TABLE...
command.

-- 
trammell at el-swifto.com  9EC7 BC6D E688 A184 9F58  FD4C 2C12 CC14 8ABA 36F5
Twin Cities Linux Users Group (TCLUG)      Minneapolis/St. Paul, Minnesota

_______________________________________________
TCLUG Mailing List - Minneapolis/St. Paul, Minnesota
http://www.mn-linux.org tclug-list at mn-linux.org
https://mailman.real-time.com/mailman/listinfo/tclug-list