- MySQL 5.1 Reference Manual :: 12 SQL Statement Syntax :: 12.8 MySQL Utility Statements :: 12.8.1 DESCRIBE Syntax
-
- MySQL 5.1 Reference Manual
- Preface, Notes, Licenses
- 1 General Information
- 2 Installing and Upgrading MySQL
- 3 Tutorial
- 4 MySQL Programs
- 5 MySQL Server Administration
- 6 Backup and Recovery
- 7 Optimization
- 8 Language Structure
- 9 Internationalization and Localization
- 10 Data Types
- 11 Functions and Operators
- 12 SQL Statement Syntax
- 13 Storage Engines
- 14 High Availability and Scalability
- 15 MySQL Enterprise Monitor
- 16 Replication
- 17 MySQL Cluster NDB 6.X/7.X
- 18 Partitioning
- 19 Stored Programs and Views
- 20 INFORMATION_SCHEMA Tables
- 21 Connectors and APIs
- 22 Extending MySQL
- A MySQL 5.1 Frequently Asked Questions
- B Errors, Error Codes, and Common Problems
- C MySQL Change History
- D Restrictions and Limits
- Index
- Standard Index
- C Function Index
- Command Index
- Function Index
- INFORMATION_SCHEMA Index
- Transaction Isolation Level Index
- JOIN Types Index
- Operator Index
- Option Index
- Privileges Index
- SQL Modes Index
- Status Variable Index
- Statement/Syntax Index
- System Variable Index
{DESCRIBE | DESC}
tbl_name
[col_name
|wild
]DESCRIBE
provides information about the columns in a table. It is a shortcut forSHOW COLUMNS FROM
. These statements also display information for views. (See Section 12.4.5.6, “SHOW COLUMNS
Syntax”.)col_name
can be a column name, or a string containing the SQL “%
” and “_
” wildcard characters to obtain output only for the columns with names matching the string. There is no need to enclose the string within quotation marks unless it contains spaces or other special characters.mysql>
DESCRIBE City;
+------------+----------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +------------+----------+------+-----+---------+----------------+ | Id | int(11) | NO | PRI | NULL | auto_increment | | Name | char(35) | NO | | | | | Country | char(3) | NO | UNI | | | | District | char(20) | YES | MUL | | | | Population | int(11) | NO | | 0 | | +------------+----------+------+-----+---------+----------------+ 5 rows in set (0.00 sec)The description for
SHOW COLUMNS
provides more information about the output columns (see Section 12.4.5.6, “SHOW COLUMNS
Syntax”).If the data types differ from what you expect them to be based on a
CREATE TABLE
statement, note that MySQL sometimes changes data types when you create or alter a table. The conditions under which this occurs are described in Section 12.1.17.1, “Silent Column Specification Changes”.The
DESCRIBE
statement is provided for compatibility with Oracle.The
SHOW CREATE TABLE
,SHOW TABLE STATUS
, andSHOW INDEX
statements also provide information about tables. See Section 12.4.5, “SHOW
Syntax”.