Removing a Row from a Table


You use the DELETE statement to remove rows from a table. As with the UPDATE statement, you typically use a WHERE clause to limit the rows you wish to delete ”if you don t, all the rows will be deleted from the table.

The following example uses a DELETE statement to remove the row from the customers table whose customer_id is 2:

 SQL>  DELETE FROM customers    2  WHERE customer_id = 2;  1 row deleted. 

SQL*Plus confirms that one row has been deleted.

To undo any changes you make to the database, you use ROLLBACK :

 SQL>  ROLLBACK;  Rollback complete. 

Go ahead and issue a ROLLBACK to undo any changes you ve made so far.




Oracle Database 10g SQL
Oracle Database 10g SQL (Osborne ORACLE Press Series)
ISBN: 0072229810
EAN: 2147483647
Year: 2004
Pages: 217

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