Perl Database Programming

DELETE is used to remove data from a table. Be careful with this one; if you simply do a DELETE statement without a WHERE clause, all of the data in the database will be removed! See the "dangerous" example below to see how easy this can be.

To delete a row from a table named library with an ISBN of 9493812345:

DELETE FROM library WHERE isbn = ‘9493812345';

The following SQL statement will remove ALL items from the library table; do NOT do that unless you truly intend to!

DELETE FROM library;

Категории