The PostgreSQL DROP TABLE articulation is utilized to eliminate a table definition and all related information, records, rules, triggers, and imperatives for that table.
You must be cautious while utilizing this order on the grounds that once a table is erased then all the data accessible in the table would likewise be lost until the end of time.
Syntax
Fundamental punctuation of DROP TABLE proclamation is as per the following −
DROP TABLE table_name;
Example
We had made the tables DEPARTMENT and COMPANY in the past section. To begin with, confirm these tables (use \d to list the tables) −
testdb-# \d
This would create the accompanying outcome −
List of relations
Schema | Name | Type | Owner
--------+------------+-------+----------
public | company | table | postgres
public | department | table | postgres
(2 rows)
This implies DEPARTMENT and COMPANY tables are available. So let us drop them as follows −
testdb=# drop table department, company;
This would create the accompanying outcome −
DROP TABLE
testdb=# \d
relations found.
testdb=#
The message returned DROP TABLE demonstrates that drop order is executed effectively.