Hi,
I have database table in mysql in that i want to remove all row from table.when i remove all row from table next auto index should start from one not the next one row.
like there are 50 records or rows in a table then i removed all the rows then after removing it should start from 1 not 51.
As you wanted to remove all the from table in mysql.
Three are two ways to remove all the from table:
- Remove All rows using , DELETE statement
- Remove All rows using , Truncate statement
1.By using DELETE , it will remove all the rows from table but it will set auto_increment value to next number.
Syntax,
DELETE from table_name;
2.By using Truncate :It will remove all the rows and set next auto_increment to 1.
Logically,It drops table and recreate table;
Syntax,
TRUNCTATE table table_name;