PostgreSQL uses DROP TABLE statements to delete tables, including table data, rules, triggers, and so on, so be careful to delete tables. After deletion, all information disappears. DROP TABLE The syntax format is as follows: In the previous section, we created two tables, COMPANY and DEPARTMENT. We can first use the\ d command to see if the table is created successfully: From the above results, we can see that our table has been created successfully, and then we delete these two tables: Use thed command to check again and you won’t find the form: 5.11.1. Grammar ¶
DROP TABLE table_name;
5.11.2. Example ¶
runoobdb=# \d
List of relations
Schema | Name | Type | Owner
--------+------------+-------+----------
public | company | table | postgres
public | department | table | postgres
(2 rows)
runoobdb=# drop table department, company;
DROP TABLE
testdb=# \d
Did not find any relations.