YouTip LogoYouTip

Postgresql Drop Table

# PostgreSQL DROP TABLE PostgreSQL uses the **DROP TABLE** statement to delete tables, including table data, rules, triggers, etc. So be careful when deleting tables, as all information will disappear after deletion. ### Syntax **DROP TABLE** syntax is as follows: ```sql DROP TABLE table_name; ### Examples In the previous chapter, we created two tables: COMPANY and DEPARTMENT. We can first use the `d` command to check if the tables were created successfully: ```sql tutorialdb=# 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 tables have been created successfully. Next, let's delete these two tables: ```sql tutorialdb=# drop table department, company; DROP TABLE Using the `d` command again, we cannot find the tables: ```sql testdb=# d Did not find any relations.
← Postgresql Insert IntoPostgresql Drop Database β†’