Difference between drop and delete? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Difference between drop and delete?

28th Mar 2016, 3:36 AM
shivam tripathi
shivam tripathi - avatar
5 Answers
+ 2
Here's a good explanation: 1. drop table tablename; After this, it's gone. No more table. No more data. Use this when you don't need that table any more. 2. truncate table tablename; After this, the table is empty, and (importantly) auto-incrementing keys are reset to 1. It's quite literally like having a brand new table. Use this when you just want an empty table. It's faster than DELETE because it simply deletes all data. DELETE will scan the table to generate a count of rows that were affected. 3. delete from tablename; This lets you filter which rows to delete based on an optional WHERE clause. Use this when you want to delete specific records, eg: DELETE FROM tablename WHERE username = 'joe
28th Apr 2016, 6:25 PM
Diana Margarit
Diana Margarit - avatar
0
delete is manipulation comand drop is a definition comand eg. u can delete a column using a drop nd for delete u can delete a line
25th Jun 2016, 7:58 AM
Domingos Inacio Caetano
Domingos Inacio Caetano - avatar
0
Drop : the whole table will be lost
3rd Oct 2016, 10:39 AM
Pavankumar V
Pavankumar V - avatar
0
Delete : it is similar to alter
3rd Oct 2016, 10:39 AM
Pavankumar V
Pavankumar V - avatar
0
DELETE is used to remove data value of certain/specific row whereas DROP can delete whole table or specified columns , not row..
5th Nov 2016, 6:03 PM
Solo Player Sabin
Solo Player Sabin - avatar