Computer >> Computer tutorials >  >> Programming >> MySQL

Difference Between DELETE and DROP in SQL


In this post, we will understand the difference between DELETE and DROP commands in SQL.

DELETE

  • It removes some or all of the tuples/records from a relation/table.

  • It is DML, i.e data manipulation language.

  • The ‘WHERE’ clause is used to add filter to it.

  • It can be rolled back since it works on data buffer.

  • Table’s memory space is not free if all records have been deleted using the ‘Delete’ Command.

  • It may encounter memory shortage.

DROP

  • It removes named elements of schema such as relations/table, constraints or the entire schema itself.

  • It is DDL, i.e data definition language.

  • It doesn’t use a ‘WHERE’ clause.

  • It can’t be rolled back, since it works directly on the data.

  • It frees the memory space.

  • It can result in memory fragmentation.