24 May 2011

How to delete all rows of MySQL table. With reseting primary key auto increment and without reseting it.

Source code viewer
  1. -- If you don'n have to preserve the current value of the AUTO_INCREMENT
  2. TRUNCATE TABLE table_name
  3.  
  4. -- To preserve the current value of the AUTO_INCREMENT
  5. DELETE FROM table_name
Programming Language: MySQL