Sunday, May 1, 2016

How to empty table records in MySQL

Sometimes when you are testing on an application, you want to empty the data/records inside a table, just to make sure that the data is correctly inserted. In this article i want to show you how to empty the whole data/records on a single table.

To empty table on mysql we can use TRUNCATE command, the syntax is TRUNCATE TABLE followed by the name of the table you want to empty.

TRUNCATE TABLE [name_of_the_table]
TRUNCATE TABLE users
TRUNCATE TABLE employee

I wrote this article as note for myself, i might forget the syntax in the future.

No comments:

Post a Comment