The DESCRIBE statement (also written as DESC) lets you inspect the structure of an existing table. It shows you each column's name, data type, whether it allows NULL values, its key role, default value, and any extra attributes like AUTO_INCREMENT. It is one of the most used commands when working with an unfamiliar database.
DESCRIBE table_name;
-- or the shorter alias:
DESC table_name;
Both forms produce identical output.
DESC students;
Sample output for the students table we created earlier:
| Field | Type | Null | Key | Default | Extra |
|---|---|---|---|---|---|
| id | int | NO | PRI | NULL | auto_increment |
| name | varchar(100) | NO | NULL | ||
| varchar(150) | NO | UNI | NULL | ||
| age | int | YES | NULL | ||
| city | varchar(80) | YES | NULL | ||
| joined_at | date | YES | NULL |
| Column | What it tells you |
|---|---|
| Field | The column name |
| Type | The data type and size (e.g. varchar(100), int) |
| Null | YES if NULL values are allowed; NO if the column has NOT NULL |
| Key | PRI = Primary Key, UNI = Unique, MUL = part of a non-unique index |
| Default | The default value used when no value is provided on insert |
| Extra | Additional info like auto_increment or on update CURRENT_TIMESTAMP |
You can describe a single column instead of the whole table:
DESCRIBE students email;
This returns only the row for the email column — useful when you want to quickly check the definition of one particular field.
For the full, exact SQL that was used to create the table — including all constraints, indexes, character sets, and storage engine — use SHOW CREATE TABLE:
SHOW CREATE TABLE students;
MySQL returns the complete CREATE TABLE statement. This is extremely useful for:
SHOW CREATE TABLE — it inserts the full CREATE statement into the query editor.
DESCRIBE table_name; or DESC table_name; shows the column structure of a table.PRI = primary key, UNI = unique constraint, MUL = index.DESCRIBE table_name column_name; to inspect a single column.SHOW CREATE TABLE table_name; returns the full CREATE statement including all constraints and engine settings.