Difference between DELETE and DROP SQL

MySQLMySQLi Database

DELETE is a Data Manipulation Language command, DML command and is used to remove tuples/records from a relation/table. Whereas DROP is a Data Definition Language, DDL command and is used to remove named elements of schema like relations/table, constraints or entire schema.

Following are the important differences between DELETE and DROP.

Sr. No.KeyDELETEDROP
1PurposeDELETE Command, removes some or all tuples/records from a relation/tableDROP Command, removes named elements of schema like relations/table, constraints or entire schema.
2LanguageDELETE is DML.DROP is DDL.
3ClauseWhere clause is used to add filtering.No where clause is available.
4RollbackDelete command can be rollbacked as it works on data buffer.Drop command can't be rollbacked as it works directly on data.
5Memory SpaceTable memory space is not free if all records are deleted using Delete Command.Drop command frees the memory space.
6ProblemDELETE command may face shortage of memory.DROP Command may cause memory fragmentation.
6InteractionSQL directly interacts with database server.PL/SQL does not directly interacts with database server.
7OrientationSQL is data oriented language.PL/SQL is application oriented language.
8ObjectiveSQL is used to write queries, create and execute DDL and DML statments.PL/SQL is used to write program blocks, functions, procedures, triggers and packages.
raja
Published on 27-Nov-2019 12:02:29
Advertisements