---
title: "What is the difference between the Truncate and Delete commands with example?"  
description: "What is the difference between the Truncate and Delete commands with example?"  
author: "Ethan Karla"  
published: 2021-09-14  
canonical: https://answers.mindstick.com/qa/93948/what-is-the-difference-between-the-truncate-and-delete-commands-with-example  
category: "database"  
tags: ["database", "database management system"]  
reading_time: 2 minutes  

---

# What is the difference between the Truncate and Delete commands with example?

What is the [difference](https://yourviews.mindstick.com/story/5016/chia-vs-basil-seeds-what-s-the-difference) between the [Truncate](https://www.mindstick.com/blog/313/difference-between-truncate-delete-statement-in-sql-server) and [Delete](https://www.mindstick.com/forum/159778/what-is-the-delete-statement-in-sql-and-how-is-it-used-to-remove-data-from-a-table) [commands](https://www.mindstick.com/interview/817/what-is-the-use-of-dbcc-commands) for example?

## Answers

### Answer by Ashutosh Kumar Verma

## SQL Truncate and Delete command :

Both SQL truncate and Delete commands are used for delete all records from a table.

## Difference between SQL Truncate and SQL Delete Command :

| **Truncate Command** | **Delete Command** |
| --- | --- |
| 1- The Truncate command is a DDL(Data Definition Language) command. | Delete command is a DML(Data Manipulation Language) command. |
| 2- Truncate command is used to delete all the data from table. | Delete command can delete a specific row of table and also delete all data form.\ |
| 3- Where clause is not used in Truncate command | Where clause is used in Delete command. |
| 4- Truncate command is delete all data from table at a time. | Delete command can delete a row where the WHERE clause fulfill the condition. |
| 5- Data delete by using Truncate command cannot be rollback | Data is deleted by using Delete command can rollback. |

| ## Example : All the data are deleted from 'StudentDetails' Table by using below statement ## truncate table StudentDetails; ![What is the difference between the Truncate and Delete commands with example?](https://answers.mindstick.com/questionanswer/cd834f01-3108-4434-9a93-4ee090aaaaca/images/9bed3bcb-fb8e-432f-abeb-fde027e8a283.png) **\** | **Example : 1-** To delete a specific record or row of table you can use following statement ## delete from StudentDetails where studentid=100; Note - you can select any field in table which is uniquely defined a row. **2-** To delete all records from StudentDetails table by using delete command, ## delete from StudentDetails; ![What is the difference between the Truncate and Delete commands with example?](https://answers.mindstick.com/questionanswer/cd834f01-3108-4434-9a93-4ee090aaaaca/images/9bed3bcb-fb8e-432f-abeb-fde027e8a283.png) **\** |
| --- | --- |

\


---

Original Source: https://answers.mindstick.com/qa/93948/what-is-the-difference-between-the-truncate-and-delete-commands-with-example

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
