your image

MySQL DELETE Statement

quackit
Related Topic
:- MYSQL

MySQL DELETE Statement

 

The DELETE statement is used to delete a record (or records) in a database table. When using the DELETE statement, you specify the table name and the record/s to be deleted.

 

DELETE FROM sakila.actor
WHERE actor_id = 204;

The above statement deletes record 204 from the actor table of the sakila database.

If we run a SELECT statement before and after the DELETE statement, here's the result.

Before:

After:

Delete All Records

You can delete all records from a table, simply by omitting the WHERE clause.

The following statement will delete all records from the actor table:

 

 
DELETE FROM sakila.actor;

The examples on this page use the Sakila sample database.

Comments