| Lesson 8 | Deleting a table |
| Objective | Process involved with deleting a table. |
When you want to get rid of a table, you can drop it from the database.
You can delete a table from an Oracle database by using the SQL syntax found in the MouseOver below:
Dropping Table
The DROP TABLE command has several different effects. It can:
- Delete all of the rows in the table
- Delete the table structure from the database
- Delete any indexes associated with the table from the database
- Remove all entries for the table and its components from the data dictionary table
You can search the appropriate tables
in the data dictionary to find out which of these conditions may occur, or use a CASE tool like Oracle Designer to help you understand
the impact of dropping a table.
CASE: C
omputer Aided Software Design, a process where the implementation details of application systems are partially determined through computerized automation.
If you only want to delete the data from a table, you can use the syntax of:
DELETE * FROM tablename
wheretablename = the unique name of the table.
As with any SQL statement, the effect of a DROP TABLE command is not made a permanent part of the database until you add a COMMIT command. You can use the ROLLBACK statement to negate the effects of a SQL statement before you issue a COMMIT command. The next lesson is the module wrap-up. Youll briefly review the topics covered in this module. You can take a quiz to see what you learned and discover topics that you need to review in a more detailed manner.
As with any SQL statement, the effect of a DROP TABLE command is not made a permanent part of the database until you add a COMMIT command. You can use the ROLLBACK statement to negate the effects of a SQL statement before you issue a COMMIT command. The next lesson is the module wrap-up. Youll briefly review the topics covered in this module. You can take a quiz to see what you learned and discover topics that you need to review in a more detailed manner.