Grokking SQL for Tech Interviews
Ask Author
Back to course home

0% completed

TRUNCATE
Table of Contents

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

TRUNCATE

In SQL, the TRUNCATE statement removes all the rows and columns from a table but retains the table structure. It doesn't delete the entire table like the DROP command.

If you want to make the table empty, you can use truncate. Here's the syntax:

TRUNCATE TABLE table_name;

DROP vs TRUNCATE

The choice between DROP and TRUNCATE depends on the specific requirements and the level of removal needed for the task at hand.

But let's discuss the differences so you can identify which one you should use according to your use case.

.....

.....

.....

Like the course? Get enrolled and start learning!

Table of Contents

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible