SHOW CREATE TABLE

语法说明

以列表的形式展现当前数据库创建的某个表的表结构。

语法结构

  1. > SHOW CREATE TABLE tbl_name

示例

  1. drop table if exists t1;
  2. create table t1(
  3. col1 int comment 'First column',
  4. col2 float comment '"%$^&*()_+@!',
  5. col3 varchar comment 'ZD5lTndyuEzw49gxR',
  6. col4 bool comment ''
  7. );
  8. mysql> show create table t1;
  9. +-------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  10. | Table | Create Table |
  11. +-------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  12. | t1 | CREATE TABLE `t1` (
  13. `col1` INT DEFAULT NULL COMMENT 'First column',
  14. `col2` FLOAT DEFAULT NULL COMMENT '"%$^&*()_+@!',
  15. `col3` VARCHAR(65535) DEFAULT NULL COMMENT 'ZD5lTndyuEzw49gxR',
  16. `col4` BOOL DEFAULT NULL
  17. ) |
  18. +-------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  19. 1 row in set (0.00 sec)