Sometimes we may decide that we need to get rid
of a table in the database for some reason or may be we don't need that's table
now. In fact,
it would be problematic if we cannot do so because this
could create a maintenance terrifying for the DBA's.
auspiciously, Any how SQL allows us to do it with SQL Drop Statement, as we can use the
SQL DROP TABLE command to delete or remove any table from the database.
The syntax for SQL DROP TABLE is
as under.
So, if we want to drop the table of Employees that were created in the
CREATE TABLE section of our SQL
Tutorial, we simply type the below query to drop this table.
With the above simplest SQL Drop command we can drop any table from the database easily.
One thing we should clear is that if we try to drop a table which is based on other
table with the constraints of
Foreign Key relationship then we can't drop this table from the
database until we drop the
Foreign key relationship first. After that we can do
so. Second thing is the most important in traditional databases if we drop
any database table then it couldn't be recover. For this we may need to
use database triggers. And some databases did not support this database
object.