Recipe4.13.Deleting Specific Records


Recipe 4.13. Deleting Specific Records

Problem

You wish to delete records meeting a specific criterion from a table.

Solution

Use the DELETE command with a WHERE clause specifying which rows to delete. For example, to delete all employees in department 10:

 delete from emp where deptno = 10 

Discussion

By using a WHERE clause with the DELETE command, you can delete a subset of rows in a table rather than all the rows.




SQL Cookbook
SQL Cookbook (Cookbooks (OReilly))
ISBN: 0596009763
EAN: 2147483647
Year: 2005
Pages: 235

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net