Macromedia ColdFusion MX 7 Certified Developer Study Guide

The DELETE Statement

The DELETE statement deletes one or more rows from a table. DELETE takes the name of the table to be processed, as well as the rows to be affected.

The following example deletes a single row from a table:

DELETE FROM products WHERE product_id=235

The WHERE clause restricts the rows being deleted, and without it, all rows are deleted.

CAUTION

Care must be taken to ensure that a WHERE clause is specified where needed (usually it will be). If you want to delete a single row, the WHERE clause should always filter by the primary key.

Категории