The DROP TABLE
statement is used for deleting an entire table. This statement deletes the table definition, data, constraints and all the info that is associated or stored in table.
Syntax:
DROP TABLE TableName;
For e.g.
Lets say we have a table named “EMPLOYEES”. This is how we can see the table definition.
SQL> DESC EMPLOYEES; +---------+---------------+------+-----+---------+ | Field | Type | Null | Key | Default | +---------+---------------+------+-----+---------+ | SSN | CHAR(10) | NO | PRI | | | EMP-NAME| varchar(35) | NO | | | | EMP_AGE | int(11) | NO | | | | EMP_ADDR| varchar(45) | YES | | NULL | +---------+---------------+------+-----+---------+ 4 rows in set (0.00 sec)
Lets delete the table.
SQL> DROP TABLE EMPLOYEES; Query OK, 0 rows affected (0.01 sec)
Lets verify whether the table dropped successfully.
SQL> DESC EMPLOYEES; ERROR: Table 'DB1.EMPLOYEES' doesn't exist
As you can see that table has been successfully deleted from the database “DB1”.
Kalimuthu says
If we have created new table i,e., Associates from an old table i.e., Employee, when we delete the parent table Employee, will it have any impact in the table Associates?
Please help to understand.