Deleting Stored Data
The deletion of entries in SQL is dangerously easy, which, if you haven'tnoticed yet, is a recurring theme. Here's the command syntax:
mysql>DELETE FROM table_name WHERE conditons;
So to delete all chicken jokes from your table, you'd use the following
query:
mysql>DELETE FROM Jokes WHERE JokeText LIKE "%chicken%";
One thing to note is that the WHERE clause is actually
optional. You should be very careful, however, if you leave it off, as the DELETE command
will then apply to all entries in the table. This command will empty the Jokes table in one fell swoop:
mysql>DELETE FROM Jokes;
Scary, huh?