MySQL Tutorial

The DELETE statement

The delete statement is used to delete records in a database. The keywords used in a delete statement are summarised in the following table.

Keyword Description
DELETE Deletes the records in one or more tables.
FROM Tables containing the records.
WHERE Criteria to restrict the records deleted.

The following example deletes all records in the search table where the category is Junk.

delete.sql

DELETE FROM search
WHERE Category = 'Junk';

The file may then be used with MySQL as follows:

mysql> \. delete.sql

You might also like...

Comments

About the author

Gez Lemon United Kingdom

I'm available for contract work. Please visit Juicify for details.

Interested in writing for us? Find out more.

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“It works on my machine.” - Anonymous