The Delete SQL query deletes a specific row you want. Using Delete Statements always my favorite statement, delete removes data from your chosen table. That’s right; you go to all that effort crafting designs, building physical models, and coding a variety of tools to create and manage your data, and with one little statement you can remove the lot.
It removes unwanted data from a table. The delete statement takes this basic form:
Delete from tablename Where criteria is are met
For those of you who’ve used other databases that are somewhat lax about standard
and syntactical correctness, the word from is not optional. As with the other DML statements,
The where clause is optional. By not specifying a where clause, all rows from a table will be removed. Using a where clause limits the rows deleted to those that match the specified criteria.
A simple example using the where clause is the following:
Delete from employee Where joindate > '2010-01-01'
One interesting aspect of the DB2 delete and update implementation is that you’ll see a
warning if the criteria you specify don’t match any rows; that is, if your delete statement won’t actually delete any rows. You’ll see this warning:
SQL0100W No row was found for FETCH, UPDATE or DELETE; or the result of a query is an empty table. SQLSTATE=02000