TRUNCATE TABLE Command in SQL – DDL Statements

In previous SQL post we had discussed about Data Definition Language and Data Manipulation Language and CREATE Command and ALTER Command and USE Command and DROP DATABASE Command.

TRUNCATE TABLE Command – DDL Statements

The TRUNCATE TABLE command used to delete all the rows/records from entire table.
The TRUNCATE command also remove the index from columns.

If we want to delete the table structure then use DROP Command. The TRUNCATE TABLE Command only delete the data from the table not the structure of table from database.

The TRUNCATE TABLE command cannot delete any data that would violate FOREIGN KEY or any other constraints.

TRUNCATE TABLE Command Syntax:

TRUNCATE  TABLE  tablename

tablename is the name of table to be truncated.

Example of TRUNCATE TABLE Command:


Delete all the records from Student table when execute above truncate command.


Leave a Reply

Your email address will not be published. Required fields are marked *

3 + 4 =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">