DROP TABLE — Removes a table and any data associated with it.
DROP TABLE table-name [IF EXISTS] [CASCADE]
The DROP TABLE statement deletes the specified table, and any data associated with it, from the database. The IF EXISTS clause allows the statement to succeed even if the specified tables does not exist. If the table does not exist and you do not include the IF EXISTS clause, the statement will return an error.
Before dropping a table, you must first remove any stored procedures that reference the table. For example, if the table EMPLOYEE is partitioned and the stored procedure AddEmployee is partitioned on the EMPLOYEE table, you must drop the procedure first before dropping the table:
PARTITION TABLE Employee ON COLUMN EmpID; CREATE PROCEDURE PARTITION ON TABLE Employee COLUMN EmpID FROM CLASS myapp.procedures.AddEmployee; [. . . ] DROP PROCEDURE AddEmployee; DROP TABLE Employee;
Attempting to drop the table before dropping the procedure will result in an error. The same will normally happen if there are any views or indexes that reference the table. However, if you use the CASCADE clause VoltDB will automatically drop any referencing indexes and views as well as the table itself.