SHOW CREATE TABLE

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

Synopsis

ShowCreateTableStmt:

ShowCreateTableStmt

TableName:

TableName

Examples

  1. mysql> CREATE TABLE t1 (a INT);
  2. Query OK, 0 rows affected (0.12 sec)
  3. mysql> SHOW CREATE TABLE t1;
  4. +-------+------------------------------------------------------------------------------------------------------------+
  5. | Table | Create Table |
  6. +-------+------------------------------------------------------------------------------------------------------------+
  7. | t1 | CREATE TABLE `t1` (
  8. `a` int(11) DEFAULT NULL
  9. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin |
  10. +-------+------------------------------------------------------------------------------------------------------------+
  11. 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