Drop More than One Table at a Time
The DROP TABLE command removes a table and its projections. You can drop more than one table at a time by specifying a comma delimited set of tables!
dbadmin=> CREATE TABLE test1 (c INT); CREATE TABLE dbadmin=> DROP TABLE test1; DROP TABLE
That was easy. How about dropping more than one table?
dbadmin=> CREATE TABLE test2 (c1 INT, c2 VARCHAR); CREATE TABLE dbadmin=> CREATE TABLE test3 (c1 INT, c2 VARCHAR, c3 BOOLEAN); CREATE TABLE dbadmin=> CREATE TABLE test4 (c1 CHAR(1)); CREATE TABLE
At first you might be tempted to run a DROP TABLES command to drop multiple tables but that won’t work
dbadmin=> DROP TABLES test2, test3, test4; ERROR 4856: Syntax error at or near "TABLES" at character 6 LINE 1: DROP TABLES test2, test3, test4; ^
It’s still the same simple DROP TABLE command:
dbadmin=> DROP TABLE test2, test3, test4; DROP TABLE