SHOW CREATE TABLE

SHOW CREATE TABLE 语句用于显示用 SQL 重新创建已有表的确切语句。

语法图

ShowCreateTableStmt:

ShowCreateTableStmt

TableName:

TableName

示例

  1. CREATE TABLE t1 (a INT);
  1. Query OK, 0 rows affected (0.12 sec)
  1. SHOW CREATE TABLE t1;
  1. +-------+------------------------------------------------------------------------------------------------------------+
  2. | Table | Create Table |
  3. +-------+------------------------------------------------------------------------------------------------------------+
  4. | t1 | CREATE TABLE `t1` (
  5. `a` int(11) DEFAULT NULL
  6. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin |
  7. +-------+------------------------------------------------------------------------------------------------------------+
  8. 1 row in set (0.00 sec)

MySQL 兼容性

SHOW CREATE TABLE 语句与 MySQL 完全兼容。如发现任何兼容性差异,请尝试 TiDB 支持资源

另请参阅