Drop
Drop a table
Dropping a table removes the table and all its data from the database.
For example, consider the following database:
CREATE NODE TABLE User(name STRING PRIMARY KEY, age INT64, reg_date DATE);CREATE REL TABLE Follows(FROM User TO User, since DATE);Consider that you try to directly drop the User node table without first dropping the associated
relationship tables.
DROP TABLE UserThis will raise the following exception:
Binder exception: Cannot delete a node table with edges. It is on the edges of rel: Follows.You can first drop the Follows relationship table, and subsequently the User table as follows:
DROP TABLE Follows┌─────────────────────────────────────┐│ RelTable: Follows has been dropped. │└─────────────────────────────────────┘DROP TABLE User┌───────────────────────────────────┐│ NodeTable: User has been dropped. │└───────────────────────────────────┘Drop if exists
If the given table does not exist in the database, Ladybug throws an exception when you try to drop it.
To avoid the exception being raised, use the IF EXISTS clause. This instructs Ladybug to do nothing when
the given table name does not exist in the database.
Example:
DROP TABLE IF EXISTS UWThis query tells Ladybug to drop the UW table only if it exists.