SHOW [FULL] COLUMNS FROM

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

    注意

    DESC TABLE <table_name>DESCRIBE TABLE <table_name>EXPLAIN TABLE <table_name> 与上面的语句并不等价,它们是 DESC SELECT * FROM 的别名。

    ShowStmt:

    ShowStmt

    ShowColumnsFilterable:

    OptFull

    FieldsOrColumns:

    ShowTableAliasOpt:

    ShowTableAliasOpt

    FromOrIn:

    TableName

    ShowDatabaseNameOpt:

    DBName:

    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. +-------+-----------+------+------+---------+-------+
    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. | 1 | bigint(1) | YES | | NULL | |
      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)
      1. show full columns from mysql.user;