## SQLWays - Tables

This chapter describes the various aspects of working with tables and implementation differences in databases.

- Dropping Tables

### Dropping Tables

The DROP TABLE statement is used to drop tables. The following statement drops the BOOKS table:

      DROP TABLE books

The table you want to drop may be referenced by a FOREIGN KEY constraint.

- IBM DB2 Universal Database drops foreign keys referencing the table.
- Oracle does not allow you to drop tables referenced by foreign keys of other tables without specifying the CASCADE CONSTRAINTS option in the DROP TABLE statement.

  The CASCADE CONSTRAINTS option drops the FOREIGN KEY constraints of the child tables. For example,

       DROP TABLE books CASCADE CONSTRAINTS

- Microsoft SQL Server and Sybase Adaptive Server do not allow you to drop referenced tables. The referencing FOREIGN KEY constraint or the referencing table must first be dropped.

To generate the CASCADE CONSTRAINTS option for Oracle

- SQLWays Wizard - DDL Options Page
- SQLWays command prompt - [DDL] Section

[Main] [Table of Contents]
Copyright © 1999-2003 Ispirer Systems. All Rights Reserved.
SQLWays™ www.ispirer.com.