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
Comments