Description

The SQL keyword DELETE is used to define a statement, that deletes one or more existing records from a table.

  • A DELETE statement can contain a WHERE condition to select records for deletion.
  • A DELETE statement without a WHERE condition deletes all records.

DELETE Single Record

A DELETE statement with a WHERE condition that selects a single record can delete a record from a table.

The below SQL deletes a record that matches the specified ID value.

DELETE FROM customers
WHERE id = 5;

DELETE Multiple Records

A DELETE statement with a WHERE condition that selects multiple records can delete multiple records from a table.

The below SQL deletes multiple records that match the specified ID values.

DELETE FROM customers
WHERE id IN (1,2,3,4,5);

DELETE All Records

A DELETE statement without a WHERE condition selects all the records for deletion.

The below SQL deletes all the records from a table.

DELETE FROM customers;

Related Links