contents.gifindex.gifprev1.gifnext1.gif

6.3.3 DELETE Command

The SQL DELETE command is used to delete one or more rows from an existing table.

Syntax:

DELETE FROM <table-name>
      [WHERE <condition>]

This command allows you to delete rows from a table according to conditions specified with the WHERE clause. The format used for the WHERE condition is the same specified for the SELECT statement. If the WHERE clause is not specified, all the rows of the table are deleted.

If the WHERE clause is specified and none of the rows matches the conditions specified, no rows are deleted. In this case no error is returned.

Example:

DELETE FROM CLIENTS
 WHERE company-name="Acucorp, Inc."

This command deletes all the rows that have the column "company-name" containing the value "Acucorp, Inc."

DELETE FROM CLIENTS

This command deletes all the rows of the table named "CLIENTS."