I need to delete all rows from a table but when I add a new row, I want the primary key ID, which has an auto increment, to start again from 0 respectively from 1.
if you want to use truncate use this:
truncate
SET FOREIGN_KEY_CHECKS = 0; TRUNCATE table $table_name; SET FOREIGN_KEY_CHECKS = 1;