5.11. PostgreSQL delete table

发布时间 :2025-10-25 12:30:50 UTC      

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.

5.11.1. Grammar

DROP TABLE The syntax format is as follows:

DROP TABLE table_name;

5.11.2. Example

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:

runoobdb=# \d
           List of relations
 Schema |    Name    | Type  |  Owner
--------+------------+-------+----------
 public | company    | table | postgres
 public | department | table | postgres
(2 rows)

From the above results, we can see that our table has been created successfully, and then we delete these two tables:

runoobdb=# drop table department, company;
DROP TABLE

Use thed command to check again and you won’t find the form:

testdb=# \d
Did not find any relations.

Principles, Technologies, and Methods of Geographic Information Systems  102

In recent years, Geographic Information Systems (GIS) have undergone rapid development in both theoretical and practical dimensions. GIS has been widely applied for modeling and decision-making support across various fields such as urban management, regional planning, and environmental remediation, establishing geographic information as a vital component of the information era. The introduction of the “Digital Earth” concept has further accelerated the advancement of GIS, which serves as its technical foundation. Concurrently, scholars have been dedicated to theoretical research in areas like spatial cognition, spatial data uncertainty, and the formalization of spatial relationships. This reflects the dual nature of GIS as both an applied technology and an academic discipline, with the two aspects forming a mutually reinforcing cycle of progress.