I have a MySQL table table with two fields: id and name. id is primary key with auto_increment. The thing is when I insert a record and then empty the table, and insert a record again, the id value does not start from 1, it keeps increasing even though the table was emptied.
How can I make the id valued to start from 1 after emptying the table.
manaila
0
Light Poster
Recommended Answers
Jump to PostHow do you empty the table, with a tool, or with a query? Your tool should have an option to do that, for the query:
ALTER TABLE `table` AUTO_INCREMENT = 1;
All 3 Replies
pritaeas
2,194
¯\_(ツ)_/¯
Moderator
Featured Poster
manaila
0
Light Poster
hericles
289
Master Poster
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.