DELETE - Deleting in SQL

DELETE - Deleting in SQL
One of the most dangerous commands you can issue is the DELETE command. Be very cautious that you use this command properly, lest you find your entire table wiped out.

The syntax is very simply

DELETE from WRITERS where WRITER_ID = 10

Anything that matches that where clause is gone, POOF, never to be seen again. You don't get an "are you sure" or "would you like to undo?" query. SQL is a powerful language, and it is assumed you know what you're doing.

I highly, highly recommend you always test, test, and then test again before you issue any delete commands. Make sure you build safeguards into your system so that people cannot get to a delete command page unless they have full authorization to do so. Just imagine if the command instead read

DELETE from WRITERS

that command would wipe out every single writer in your database, with that one line. If you forget to add on the WHERE clause properly, you could be doomed.

Which of course brings us to the Always Back Up your Data instruction. Have frequent backups. Do not overwrite your backups with new backups. Sometimes a week or more can go by before you realize that something disastrous was done to your data. It's important to have the ability to go back to a correct save set.




RSS
Related Articles
Editor's Picks Articles
Top Ten Articles
Previous Features
Site Map





Content copyright © 2023 by Lisa Shea. All rights reserved.
This content was written by Lisa Shea. If you wish to use this content in any manner, you need written permission. Contact Lisa Shea for details.