I am attempting to clean out a table but not get rid of the actual structure of the table. I have an id
column that is auto-incrementing; I don't need to keep the ID number, but I do need it to keep its auto-incrementing characteristic. I've found delete and truncate but I'm worried one of these will completely drop the entire table rendering future insert commands useless.
How do I remove all of the records from the table so that I can insert new data?
drop table
will remove the entire table with data
delete * from table
will remove the data, leaving the autoincrement values alone. it also takes a while if there's a lot of data in the table.
truncate table
will remove the data, reset the autoincrement values (but leave them as autoincrement columns, so it'll just start at 1 and go up from there again), and is very quick.