105 SQL DROP TABLE
The current webpage explains the SQL DROP TABLE statement. Hereās a concise summary:
-
The
DROP TABLEstatement in SQL is used to permanently delete an existing table from a database, removing both the table structure and all its data. -
Syntax:
DROP TABLE table_name; -
Important Note: Dropping a table is irreversible and will result in the loss of all the data stored within that table.
-
An example is provided using a table named "Shippers":
DROP TABLE Shippers; -
The page also distinguishes
DROP TABLEfromTRUNCATE TABLE, whereTRUNCATEdeletes all data but keeps the table structure. -
The page includes a quick exercise question and navigation to related SQL topics and tutorials, emphasizing caution when using DROP TABLE as it deletes all data and the table itself.[1]
The SQL DROP TABLE Statement
TheĀ DROP TABLEĀ statement is used to drop an existing table in a database.
Syntax
DROP TABLE table_name;
Note**:**Ā Be careful before dropping a table. Deleting a table will result in loss of complete information stored in the table!
SQL DROP TABLE Example
The following SQL statement drops the existing table "Shippers":
DROPĀ TABLEĀ Shippers;
SQL TRUNCATE TABLE
TheĀ TRUNCATE TABLEĀ statement is used to delete the data inside a table, but not the table itself.
Syntax
TRUNCATE TABLE table_name;