Computer >> Computer tutorials >  >> Programming >> MySQL

How can we delete all rows from a MySQL table?


We can use either TRUNCATE statement or DROP statement to delete all the rows from the table. It can also be done with the help of DELETE statement but in that case WHERE clause must identify all the rows of the table. As we know that both TRUNCATE and DELETE statement will not delete the structure of the table but still it is better to use TRUNCATE statement rather than DELETE statement. DROP statement will delete table’s structure also.

Syntax

TRUNCATE statement

TRUNCATE table table_name:

Syntax

DROP statement

DROP table table_name: