DELETE
The DELETE statement is
relatively simple to understand but can be used to delete one or more rows
from one or more tables. As for the UPDATE statement, it is important to
remember not to omit the WHERE clause when using this statement, otherwise
all data in a table can be deleted.
The DELETE statement takes the
following form:
DELETE FROM tablename1,
tablename2
WHERE condition1, condition2
An example of DELETE in action
is as follows:
Example:
DELETE
FROM tblAddressBook
WHERE Age andlt; 21
This example will
delete all rows in the table where the age is less than 21. If the WHERE
clause had been omitted then all rows would have been deleted from the
table. DELETE cannot be used to delete columns, only entire rows. To delete
all values from a column use the UPDATE statement. |