In order to delete all data from a table and not the table itself we may use the TRUNCATE TABLE statement.



In the example above, the MySQL server will delete entire table and create a new one of the same name but empty. However if working with InnoDB storage engine, and there is one or more FOREIGN KEYS found, the TRUNCATE TABLE will delete rows one by one. Also, if DELETE CASCADE action is not specified, and there is a table's row having a reference by a row in a child table, an error will be thrown and process will stop.