Account
Categories

MySQL DESC Command


In SQL, the DESC (DESCRIBE) command is used to see the structure of a table.

It shows details like column names, data types, and other settings.

This means, when you create a table and set the field names, data types, etc., the DESC command shows that same setup as the table’s structure.

Syntax:

DESC table_name;

Command:

DESC students;

Example:

CREATE TABLE students (
    id INT,
    name VARCHAR(50),
    age INT,
    admission_date DATE
);

Output:

id              int            YES              NULL
name            varchar(50)    YES              NULL
age             int            YES              NULL
admission_date  date           YES              NULL