SHOW COLUMNS

Description

SHOW COLUMNS displays information about the columns in a given table.

Syntax

1. > SHOW [FULL] {COLUMNS}
2. {FROM | IN} tbl_name
3. [{FROM | IN} db_name]
4. [LIKE 'pattern' | WHERE expr]

Examples

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 columns from t1;
9. +-------+----------------+------+------+---------+-------+-------------------+
10. | Field | Type           | Null | Key  | Default | Extra | Comment           |
11. +-------+----------------+------+------+---------+-------+-------------------+
12. | col1  | INT            | YES  |      | NULL    |       | First column      |
13. | col2  | FLOAT          | YES  |      | NULL    |       | "%$^&*()_+@!      |
14. | col3  | VARCHAR(65535) | YES  |      | NULL    |       | ZD5lTndyuEzw49gxR |
15. | col4  | BOOL           | YES  |      | NULL    |       |                   |
16. +-------+----------------+------+------+---------+-------+-------------------+
17. 4 rows in set (0.02 sec)