DELETE

Syntax:

DELETE [LOW_PRIORITY|QUICK] FROM table_name
  [WHERE where_definition]
  [ORDER BY column_list]
  [LIMIT num_rows]

Description: Deletes rows of data from table_name where any conditions given by WHERE where_definition are met. Without where_definition, all rows are deleted.

LOW_PRIORITY can be used to delay the action until no other clients are reading from the table.

QUICK can speed up deletes in some circumstances because the index leaves will not be merged during the delete.

LIMIT can be used to limit the number of rows deleted to num_rows. ORDER BY may be used with LIMIT to sort on a column or columns given by column_list before deleting the first num_rows in the sort order.

Multitable syntax (from MySQL 4.0):

 DELETE [LOW_PRIORITY|QUICK] ...

Get Sams Teach Yourself MySQL in 21 Days, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.