Database Reference
In-Depth Information
Figure 9.1
The webpage2 table.
DELETE FROM
webpage2
WHERE
id=2
As you see from Figure 9.2, this has cleanly removed the row. As we were referring to a
row specifically by using its primary key, it was safe enough to delete it as we did.
The problem comes when you want to delete a few rows using some pattern matching.
You must be sure that you know what you are about to remove. One of the ways to ensure
that you are deleting the right rows is to try and select them with the same criteria first. For
instance, if we wanted to delete the How to contact me row with pattern matching, test the
match first with a SELECT as follows:
SELECT *
FROM
webpage2
WHERE
title LIKE 'Ho%'
Figure 9.2
The webpage2 table after removing a row.
Search WWH ::




Custom Search