Difference between DELETE, DROP & TRUNCATE in MySQL|| MySQL Tutorial || Code With Neha

Published: 19 March 2025
on channel: Code With Neha
178
33

In my previous video of mysql series I have discussed about the difference between drop and delete command in mysql
You can check the video from the above I button

Today I am going to discuss about the difference between drop , delete and truncate statement in mysql
Which is very also important for interviews
So without any further delay let's get started


MySQL TRUNCATE TABLE Statement

The MySQL TRUNCATE TABLE statement is used to delete only the data of an existing table, but not the table.

Truncate command is a DDL i.e; Data Definition Language

This command helps to TRUNCATE a table completely in one go instead of deleting table records one by one which will be very time consuming and hefty process.

Syntax

Following is the basic syntax of the TRUNCATE TABLE statement −

TRUNCATE TABLE table_name

Let's apply this with some examples

Today I am using CUSTOMERS1 table under orders_infotech database

Simply using query

Truncate table CUSTOMERS1;

Here we can see only data is deleted but the structure of table remained

Let's apply this to the same table CUSTOMERS1

QUERY TO DELETE DETAILS OF EMPLOYEE NAMED RAMESH FROM THE TABLE


DELETE FROM CUSTOMERS1
WHERE EMPLOYEENAME = 'Rakesh';

Execute the query you will see details of rakesh is deleted

In the same process delete the details of komal from the table

To drop the table

DROP TABLE CUSTOMERS1;

After executing the query we can see the entire table CUSTOMERS1 is deleted



that's all for today Hope you all will get some help from this video
If it's so then don't forget to subscribe my channel Code with Neha and press the Bell Icon for Regular Updates
See you in the next video till then Stay Safe Stay Happy

#differencebetweendropanddeletecommand
#differencebetweendropanddeletecommandinsql
#differencebetweendropanddeletecommandinmysql
#droptableinmysql
#deletetableinmysql
#howtodroptableinmysql
#howtodeletetableinmysql
#deletetabledatainmysql
#droptablecommandinmysql
#droptablecommandinsql
#deletetableommandinmysql
#deletetablecommandinsql
#deletecommandinMySQL
#dropcommandinsql
#deletecommandinsql
#Deleteinsql
#Differencebetweendeleteandtruncateinsql
#Sqlinterviewquestions
#Differencebetweendeleteanddropinsql
#Deletevstruncateinsql
#Deletevstruncatevsdropinsql
#Sqlbasics
#Sqldeletevstruncatevsdrop
#Whatisthedifferencebetweendelete andtruncate
#mysql
#mysqldb
#mysqltutorials
#mysqltutorialforbeginners
#mysqlupdatecommand
#sqlupdatecommand
#mysqldatabase
#mysqlcourse
#mysqldatabasetutorial
#mysqlcrashcourse
#mysqltutorialforbeginners
#learnmysql
#learnsql
#SqlDMLcommands
#createinsertupdateinsql
#sqlupdatequery
#sqlcommands
#sqlqueries
#structuredquerylanguage
#sqlinterviewquestions
#sqlbasics
#sqlforbeginners