How to make a primary key that is autoincrementable start from scratch?

1

Good afternoon friends a question about sql in particular phpmyadmin happens that I want a table or good several tables ids primary key autoincrementable start from scratch, since I have deleted everything from scratch but when inserting data puts me one more number to the last what was there, why? If I already delete everything, how do I start from scratch please.

for example if I delete that row and re-insert insurance that inserts 15 and I want to insert from scratch thanks in advance.

    
asked by David Garcia 28.10.2018 в 05:03
source

1 answer

2

Well, if we read the official MySQL help about the AUTO_INCREMENT:

We see that the action to restart or set a new start value to the field of a table is as simple as:

ALTER TABLE tblname AUTO_INCREMENT = 0;

Where tblname will be the name of our table and 0 the number by which you must restart (it can be 0 or 50 or 1000, whichever we want).

    
answered by 28.10.2018 / 05:12
source