DROP TABLE

    DropTableStmt

    DROP TABLE - 图2

    TableOrTables

    TableNameList

    • DROP TEMPORARY TABLE 只能删除本地临时表
    • DROP GLOBAL TEMPORARY TABLE 只能删除全局临时表
    1. CREATE TABLE t1 (a INT);
    1. DROP TABLE t1;
    1. Query OK, 0 rows affected (0.22 sec)
    1. ERROR 1051 (42S02): Unknown table 'test.table_not_exists'
    1. DROP TABLE IF EXISTS table_not_exists;
    1. Query OK, 0 rows affected, 1 warning (0.01 sec)
      1. CREATE VIEW v1 AS SELECT 1;
      1. Query OK, 0 rows affected (0.10 sec)
      1. DROP TABLE v1;
      1. Query OK, 0 rows affected (0.23 sec)
      • 目前 RESTRICT 和 仅在语法上支持。