SHOW CREATE TABLE

This statement shows the exact statement to recreate an existing table using SQL.

Synopsis

ShowCreateTableStmt

SHOW CREATE TABLE - 图1

  1. ShowCreateTableStmt ::=
  2. "SHOW" "CREATE" "TABLE" (SchemaName ".")? TableName

Examples

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

MySQL compatibility

The SHOW CREATE TABLE statement in TiDB is fully compatible with MySQL. If you find any compatibility differences, report a bug.

See also