Entry
How can I see the field types for all columns in a table?
What does DESCRIBE table_name do?
Jan 25th, 2000 06:44
Nathan Wallace, Jay J
You can get a print out of all the fields in a table with their types by
using the DESCRIBE query:
http://www.mysql.com/Manual_chapter/manual_Reference.html#DESCRIBE
For example:
mysql> create table test
-> (
-> n tinyint(4) ZEROFILL,
-> m varchar(10)
-> );
Query OK, 0 rows affected (0.02 sec)
mysql> insert into test values (0103,'MYName');
Query OK, 1 row affected (0.02 sec)
mysql> select * from test;
------ --------
| n | m |
------ --------
| 0103 | MYName |
------ --------
1 row in set (0.01 sec)
mysql> describe test;
------- ------------------------------ ------ ----- --------- -------
| Field | Type | Null | Key | Default | Extra |
------- ------------------------------ ------ ----- --------- -------
| n | tinyint(4) unsigned zerofill | YES | | NULL | |
| m | varchar(10) | YES | | NULL | |
------- ------------------------------ ------ ----- --------- -------
2 rows in set (0.00 sec)