background image
<< Using UPDATE Statements | Controlling Transactions >>
<< Using UPDATE Statements | Controlling Transactions >>

Using DELETE Statements

Adding, Changing, and Deleting Data
Querying and Manipulating Data 2-29
WHERE last_name = 'Keats';
The results of the query appear.
1 row updated.
Your result shows that the matching row has been updated.
Example 2­49
shows how you can use the
UPDATE
statement to update multiple rows.
Example 2­49 Using the UPDATE Statement to Change Data
UPDATE employees
SET commission_pct=commission_pct + 0.05
WHERE department_id = 80;
The results of the query appear.
36 rows updated.
Your result shows that the specified rows are updated.
Deleting Information
Using the
DELETE
statement, you can delete specific rows in a table. If you want to
delete all the rows in the table, the empty table still exists. If you want to remove the
entire table from the database, use the
DROP TABLE
statement.
Note that if you accidentally delete rows, you can restore the rows with the
ROLLBACK
statement.
Example 2­50
shows how you can use the
DELETE
statement to remove the data you
added previously.
Note the use of the
WHERE
clause; without it, all the rows are deleted.
Example 2­50 Using the DELETE Statement
DELETE FROM employees
WHERE hire_date = '1-Jan-2007';
The results of the query appear.
2 rows deleted.
Your result shows that the specified rows are deleted.
See Also:
Oracle Database SQL Language Reference for information about
UPDATE
See Also:
Oracle Database SQL Language Reference for information about
DELETE
statement
Oracle Database SQL Language Reference for information about
DROP TABLE
Oracle Database SQL Language Reference for information about
ROLLBACK
statement