This MySQL statement displays information about the columns of a given MySQL table.


Below is the syntax for this command. Text within square brackets (i.e, [ and ] ) are optional. Choices are separated by bars (i.e, | ). Ellipses preceded by a comma indicates a repeating pattern. Ellipses before or after syntax are used to highlight a relevant except from the larger syntax. Text displayed in italic letters represent text that should be replaced with the specific names related to the database (e.g., column with the name of the column).

{DESCRIBE|DESC} table [column]


This MySQL statement displays information about the columns of a given MySQL table. DESCRIBE can be shorted to just DESC.


Below is an example of this MySQL statement along with an example of the results from it:

DESCRIBE workreq;

| Field              | Type    | Null | Key | Default | Extra          |
| req_id             | int(11) | NO   | PRI | NULL    | auto_increment | 
| client_id          | int(11) | YES  |     | NULL    |                | 
| client_description | text    | YES  | MUL | NULL    |                | 
| technician_notes   | text    | YES  |     | NULL    |                | 

For information on a specific column, supply only the column name. For information on multiple columns, but not all columns, you can supply a name pattern within quotes and use the wildcard characters % and _. Quotes around the string aren't necessary unless the string contains spaces.

To list the columns in the workreq table that have names that begin with the characters client, enter the following:

DESCRIBE workreq 'client%';

| Field              | Type    | Null | Key | Default | Extra |
| client_id          | int(11) | YES  |     | NULL    |       | 
| client_description | text    | YES  | MUL | NULL    |       | 

The fields in the results have the fllowing meanings:

  • Field: Lists the name of each column in the table.
  • Type: Shows the data type of each column.
  • Null: Indicates whether the column in the table may contain a NULL value.
  • Default: Shows the default value of the column.
  • Key: Indicates what type of key the column is. If this field is empty, the column is not indexed. A value of PRI indicates a PRIMARY KEY column, UNI indicates a UNIQUE indexed column, and MUL means that multiple occurrences, or duplicate values, are allowed for the column. This is allowed because the column is only one of multiple columns making up an index of which is a part.
  • Extra: Lists any extra information particular to the column.

To understand how the options you use when creating or altering a table affect the output of DESCRIBE, let's look at the schema of the table shown in the previous example.


*************************** 1. row ***************************
       Table: workreq
Create Table: CREATE TABLE `workreq` (
  `req_id` int(11) NOT NULL AUTO_INCREMENT,
  `client_id` int(11) DEFAULT NULL,
  `client_description` text,
  `technician_notes` text,
  PRIMARY KEY (`req_id`),
  FULLTEXT KEY `notes_index` (`client_description`,`technician_notes`)

The results of this MySQL statement, SHOW CREATE TABLE indicate that client_description is part of the index called notes_index. The other column that is part of that index is technician_notes. Notice in the results of the earlier DESCRIBE statement that only the first column of the index is marked MUL.