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. | Key | DELETE | DROP |
---|---|---|---|
1 | Purpose | DELETE Command, removes some or all tuples/records from a relation/table | DROP Command, removes named elements of schema like relations/table, constraints or entire schema. |
2 | Language | DELETE is DML. | DROP is DDL. |
3 | Clause | Where clause is used to add filtering. | No where clause is available. |
4 | Rollback | Delete command can be rollbacked as it works on data buffer. | Drop command can't be rollbacked as it works directly on data. |
5 | Memory Space | Table memory space is not free if all records are deleted using Delete Command. | Drop command frees the memory space. |
6 | Problem | DELETE command may face shortage of memory. | DROP Command may cause memory fragmentation. |
6 | Interaction | SQL directly interacts with database server. | PL/SQL does not directly interacts with database server. |
7 | Orientation | SQL is data oriented language. | PL/SQL is application oriented language. |
8 | Objective | SQL 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. |