Truncate Query in MYSQL by R4R Team

Truncate command:
Basically, this command delete all data of the table but the structure of the table still remain in the table.

Syntax:
TRUNCATE TABLE table_name;

SELECT * FROM library;

Id Stud_name Book_Id
1 Aman 234
2 Ram 213
3 Ramesh 89
4 John 567

Now we delete all record of the table:

TRUNCATE TABLE library;

SELECT * FROM library;

Id Stud_name Book_Id

As you see, there is no more record in this table.

Leave a Comment: