What is the difference between Truncate, Drop and Delete statement? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 12

What is the difference between Truncate, Drop and Delete statement?

15th Feb 2018, 8:18 PM
A͢J
A͢J - avatar
6 Answers
+ 4
delete means delete selected or particular entries from table like using where clause. truncate is use to delete all entries from table. and drop is use to destory table from database
28th Aug 2018, 6:25 PM
Sunny
Sunny - avatar
+ 2
(I assume you work on tables) Truncate deletes all rows of a table leaving the table empty in your database Delete deletes rows who matches your WHERE statement (can also be used for deleting all rows if you leave the Where out but is much slower) Drop removes the whole table with all rows and columns Usage: Truncate for deleting every entry in a table because you want to keep the structure but want to start over Delete for individual delete requests if a single user wants to delete his second email etc Drop if you not only want to delete the entries but the whole table because you have a better idea how to structure your data in a new table
16th Feb 2018, 7:29 AM
Chrizzhigh
Chrizzhigh - avatar
+ 1
Delete is a DML command in sql and drop is DDL command and truncate is also DDL command but the difference between truncate and drop is that if you drop a table than the table will deleted from the database but if you write truncate table name than structure of table will remain in the your database That's the main difference among these three commands
10th Oct 2019, 4:04 AM
Sanjay Tiwari
Sanjay Tiwari - avatar
0
drop means to remove the database table as well as delete is to delete the table
16th Feb 2018, 12:38 PM
Ebere Charles
Ebere Charles - avatar
0
- drop command is used to remove a table from the database. - truncate command is used to delete the data inside a table, but not the table itself. - delete is used to delete the existing records from a table.
8th Mar 2018, 3:07 AM
Tanoh Le Kadiographe
Tanoh Le Kadiographe - avatar
0
drop means remove all contents in your database. delete means. delete only you selected.
9th Mar 2018, 2:53 AM
Delmar Hayudini Gulam
Delmar Hayudini Gulam - avatar