What are the synonym statements of MySQL DESCRIBE?


Followings are the synonyms statements of MySQL DESCRIBE i.e. the statements with the help of which we can get the same kind of information/structure of the table as we get from DESCRIBE −

EXPLAIN Statement

EXPLAIN is the synonym of the DESCRIBE statement. Its syntax is also similar to the DESCRIBE statement. Consider the following example −

mysql> Explain Employee;
+-------+-------------+------+-----+---------+------------------+
| Field | Type        | Null | Key | Default | Extra            |
+-------+-------------+------+-----+---------+------------------+
| ID    | int(11)     | NO   | PRI | NULL    | auto_increment   |
| Name  | varchar(20) | YES  |     | NULL    |                  |
+-------+-------------+------+-----+---------+------------------+
2 rows in set (0.11 sec)

We can see this statement also gives the same output as we got with DESCRIBE statement.

SHOW COLUMNS Statement

This statement is also a synonym of DESCRIBE and hence of statement EXPLAIN too. Its syntax is a bit different from DESCRIBE and EXPLAIN as follows −

Syntax

SHOW COLUMNS From Table_name;

Example

In the example given below, we can see that the output is the same as we have received the output from DESCRIBE and EXPLAIN statement

mysql> Show columns from employee;
+-------+-------------+------+-----+---------+------------------+
| Field | Type        | Null | Key | Default | Extra            |
+-------+-------------+------+-----+---------+------------------+
| ID    | int(11)     | NO   | PRI | NULL    | auto_increment   |
| Name  | varchar(20) | YES  |     | NULL    |                  |
+-------+-------------+------+-----+---------+------------------+
2 rows in set (0.11 sec)

Updated on: 22-Jun-2020

172 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements