DELETE is an SQL command for deleting data from a table in a (relational) database. Here is an example:
DELETE FROM example WHERE nickname='hax0r'
The statement above tells the database to delete all rows where the field
nickname has the value
'hax0r' (a string) in the table called
The WHERE clause is the same as the one used by SELECT and UPDATE. If the WHERE clause is omitted, then all rows in the table will be deleted.
Here are some things that can cause the delete to fail:
- Another table references the data in the table through a foreign key, and the foreign key does not cascade deletes. The delete only fails if there are rows in the referencing table with the same key values as the row(s) being deleted.
- The user does not have permission to delete data from the table.