Home »
MySQL
How to describe a table in MySQL?
Learn, how to describe a table in MySQL?
Submitted by Apurva Mathur, on November 30, 2022
In MySQL, whenever we want to see the structure of the entire table then in such case, we can use DESCRIBE statement. Here the structure of a table means, what all constraints are applied to the column, and what is the data type of a particular column. To easily get all the information the about the table, we only have to use DESCRIBE statement. This statement also gives us information on whether the column will accept NULL values or not.
Syntax:
DESCRIBE table_name;
Here, DESCRIBE is the keyword, and "table_name" is the name of the table of which you want to know the entire structure.
Let us see the practical demonstration of the statement,
Suppose I have a database named students, and inside this database, I have the following tables,
The USE command will help us to select the database, and the other command help us to list down all the tables present inside that database.
Now if I want to know the entire structure of the table named as details then in such case, we will use DESCRIBE statement in the following manner;
As you can see, all the information regarding each and every column in now displayed in front of us.
This is how we can easily get the table structure with column definition in MYSQL with the help of DESCRIBE statement.