DROP <object>

Removes the specified object from the system.

See also:

CREATE <object> , SHOW <objects> , UNDROP <object>

Syntax

DROP <object_type> [ IF EXISTS ] <identifier>  [ CASCADE | RESTRICT ]
Copy

For specific syntax, usage notes, and examples, see:

Organization Objects:

Account Objects:

Database Objects:

Classes:

General usage notes

  • The DROP command can include an IF EXISTS clause. If specified and the target object does not exist, the command does not return an error and completes successfully.

  • The CASCADE | RESTRICT parameters apply only to databases, schemas, and tables, and is used to specify whether the object can be dropped if foreign keys that reference the object exist:

    • CASCADE drops the object, along with all the foreign keys that reference the object.

    • RESTRICT returns a warning and does not drop the object.

Examples

DROP DATABASE mydb;

DROP DATABASE IF EXISTS mydb;

DROP DATABASE IF EXISTS mydb RESTRICT;

DROP DATABASE IF EXISTS mydb CASCADE;
Copy
Language: English