SQL DROP TABLE
SQL DROP TABLE statement is used to drop or delete a table from a database. The table can be referenced by just the table name, or using schema name in which it is, or also using the database in which the schema or table exists.
Syntax
The syntax of a SQL DROP TABLE statement is
</>
Copy
DROP TABLE table_name;
DROP TABLE schema_name.table_name;
DROP TABLE database_name.table_name;
DROP TABLE database_name.schema_name.table_name;
where
Argument | Description |
---|---|
table_name | Name of the table which has to be dropped. |
schema_name | Name of the schema in which the table exists. |
database_name | Name of the database in which the specified schema or table exists. |
DROP TABLE
SQL DROP TABLE Query to drop the table table_name
is
</>
Copy
DROP TABLE table_name;
Examples
</>
Copy
DROP TABLE students;
DROP TABLE employees;
DROP TABLE from Specified Schema
SQL DROP TABLE Query to drop the table table_name
from the schema schema_name
is
</>
Copy
DROP TABLE schema_name.table_name;
Examples
</>
Copy
DROP TABLE athletes.students;
DROP TABLE shipping.employees;
DROP TABLE from Specified Database
SQL DROP TABLE Query to drop the table table_name
from the schema schema_name
is
</>
Copy
DROP TABLE database_name.table_name;
Examples
</>
Copy
DROP TABLE school.students;
DROP TABLE organization.employees;
DROP TABLE from Specified Schema in Specific Database
SQL DROP TABLE Query to drop the table table_name
from the schema schema_name
present in the database database_name
is
</>
Copy
DROP TABLE database_name.schema_name.table_name;
Examples
</>
Copy
DROP TABLE school.athletes.students;
DROP TABLE organization.shipping.employees;