SQL Query to Print Table Structure

While developing different applications, sometime we need to get the detailed information about a table. For example, list of columns, their data types, whether the columns allows null value or not, is the column is primary key or not and what is the default value of each column.

We can use describe keyword of SQL to fetch the structure of details of a table. The exact query is as follows:

>describe students;

where students is the name of your table of the database you are currently connected with.

Comments