Practical 5: Dropping a Table
2024, May 8
The DROP TABLE
command is used to delete a table along with all its rows from the database. This operation removes the table's structure and all its data, unlike deleting all records, which leaves the table's structure intact.
To delete an entire table, issue the DROP TABLE
command followed by the table name:
DROP TABLE "tablename";
For example, to drop a table named myemployees_ts0211
, you would use the following command:
DROP TABLE myemployees_ts0211;
DROP TABLE
removes the table definition, its data, and any associated constraints.DROP TABLE
command.Practice by dropping your employee table using the DROP TABLE
command:
DROP TABLE employee;
When a table is dropped, the following happens: