00 Votes

MySQL: How can I empty all fields of a table?

Question by Chematik | 2012-02-24 at 17:41

I have a MySQL table, in which I want to clear the data completely. How do I do that? Is there a specific command? I can not go through each record individually and delete each one separately...

ReplyPositiveNegative
0Best Answer0 Votes

The command you're looking for is called TRUNCATE and you use it as follows:

TRUNCATE TABLE tab;

Instead of "tab", you just have to insert the name of the table to be deleted. But be careful: The data is then gone and can not be recovered. Thus, you should think about exactly what you're doing!
2012-02-24 at 21:59

ReplyPositive Negative
Reply

Related Topics

Important Note

Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.

Participate

Ask your own question or write your own article on askingbox.com. That’s how it’s done.