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.


Popular posts from this blog

Task 12 - Create Java Program with MySQL Database Connectivity

Java Interfaces and Exception Handling - Practice Problem with Solution

Task 16 - Javafx Program to Create, Retrieve, Update and Delete records with Database