Reprence Html CSS javascript PHP MySQL Bootsrap

MySQL DELETE Statement

The DELETE statement is used to delete existing records in a table.



DELETE Syntax

42

Demo Database

Below is a selection from the "Customers" table in the Northwind sample database:

43

SQL DELETE Example

The following SQL statement deletes the customer "Alfreds Futterkiste" from the "Customers" table:

Example:
44

The "Customers" table will now look like this:


45

Delete All Records

It is possible to delete all rows in a table without deleting the table. This means that the table structure, attributes, and indexes will be intact:


46

The following SQL statement deletes all rows in the "Customers" table, without deleting the table:


47