Truncate Table in SQL

Truncating the table will not drop the structure of the table from the database, but it will only remove the data stored in the table. It will also release all the memory held by the table.

TRUNCATE TABLE CATEGORY;

This will delete all the data present in the table. But since it has child table – BOOK_CATEGORY, it would expect child table to be truncated first and then the parent table. But it will not remove the structure / attributes and constraints of the tables. Hence truncating order of the tables would be :

TRUNCATE TABLE BOOK_CATEGORY;
TRUNCATE TABLE CATEGORY;


Next > < Prev
Scroll to Top