刪除Schema
文法
DROP {DATABASE | SCHEMA}
[IF EXISTS]
database_name
[RESTRICT|CASCADE]
參數
RESTRICT:如果該database不為空白(有表存在),DROP操作會報錯,執行失敗,RESTRICT是預設邏輯。
CASCADE:即使該database不為空白(有表存在),DROP也會串聯刪除下面的所有表。
樣本
mysql> show tables;
+----------------------+
| TABLE_NAME |
+----------------------+
| nation_text_string |
| primitives_parquet_p |
+----------------------+
2 rows in set (0.04 sec)
mysql> drop database myfirstdb;
ERROR 18802 (HY000): DropOperationFailedException:Can not drop non-empty database.
mysql> drop database myfirstdb cascade;
Query OK, 0 rows affected (0.94 sec)