This will delete all data in a table but unlike a DROP TABLE it will allow you to keep the table in your database.
5
6
.. code-block:: mysql
4
This will delete all data in a table but unlike a DROP TABLE it will allow you to keep the table in your database. It deletes the rows but leaves all counters, such as a SERIAL, in place. ::
7
5
8
6
TRUNCATE TABLE table_name
9
10
TRUNCATE TABLE is typically faster than a DELETE * FROM TABLE query. An
11
unbounded DELETE query will have to generate log data for every
12
row in the table, which could be quite large. TRUNCATE TABLE is the same
13
as DROP followed by CREATE except that the absence of the table between