CHum 240

SQL DELETE Statement

The SQL DELETE statement removes rows from a table.

  delete from movie where score < 5;

To see the result:
  select * from movie;

If you do not include the WHERE clause, the DELETE statement
will, without complaint or warning, empty the entire table.

To protect yourself from doing this accidentally, learn to 
automatically enter the DELETE statment like this:

  delete where

If you submit this query without completing the WHERE 
clause, and error will occur and nothing will be deleted.

If you accidentally delete all the rows, there is no way
to get them back. Sorry, too bad.

BE CAREFUL! Pause a moment and look and think before 
submitting a DELETE query.

- - - -

Copyright ©2007 Brigham Young University