SHOW [FULL] COLUMNS FROM

    语句用于以表格格式描述表或视图中的列。可选关键字 FULL 用于显示当前用户对该列的权限,以及表定义中的 comment

    SHOW [FULL] FIELDS FROM <table_name>DESC <table_name>DESCRIBE <table_name>EXPLAIN <table_name> 语句都是 SHOW [FULL] COLUMNS FROM 的别名。

    ShowStmt:

    ShowColumnsFilterable:

    OptFull:

    OptFull

    FieldsOrColumns:

    ShowTableAliasOpt:

    ShowTableAliasOpt

    FromOrIn:

    TableName:

    ShowDatabaseNameOpt:

    ShowDatabaseNameOpt

    DBName:

    ShowLikeOrWhereOpt:

    1. Query OK, 0 rows affected (0.11 sec)
    1. show columns from v1;
    1. +-------+-----------+------+------+---------+-------+
    2. | Field | Type | Null | Key | Default | Extra |
    3. | 1 | bigint(1) | YES | | NULL | |
    4. +-------+-----------+------+------+---------+-------+
    5. 1 row in set (0.00 sec)
    1. desc v1;
      1. +-------+-----------+------+------+---------+-------+
      2. | Field | Type | Null | Key | Default | Extra |
      3. +-------+-----------+------+------+---------+-------+
      4. | 1 | bigint(1) | YES | | NULL | |
      5. +-------+-----------+------+------+---------+-------+
      6. 1 row in set (0.00 sec)
      1. explain v1;
      1. +-------+-----------+------+------+---------+-------+
      2. | Field | Type | Null | Key | Default | Extra |
      3. +-------+-----------+------+------+---------+-------+
      4. +-------+-----------+------+------+---------+-------+
      5. 1 row in set (0.00 sec)
      1. | Field | Type | Null | Key | Default | Extra |
      2. +-------+-----------+------+------+---------+-------+
      3. | 1 | bigint(1) | YES | | NULL | |
      4. +-------+-----------+------+------+---------+-------+
      5. 1 row in set (0.00 sec)
      1. show full columns from v1;
      1. +-------+-----------+-----------+------+------+---------+-------+---------------------------------+---------+
      2. | Field | Type | Collation | Null | Key | Default | Extra | Privileges | Comment |
      3. +-------+-----------+-----------+------+------+---------+-------+---------------------------------+---------+
      4. | 1 | bigint(1) | NULL | YES | | NULL | | select,insert,update,references | |
      5. +-------+-----------+-----------+------+------+---------+-------+---------------------------------+---------+
      6. 1 row in set (0.00 sec)

      SHOW [FULL] COLUMNS FROM 语句与 MySQL 完全兼容。如发现任何兼容性差异,请在 GitHub 上提交 。