What are the synonym statements of MySQL DESCRIBE?

MySQLMySQLi Database

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)
raja
Published on 21-Feb-2018 13:09:13
Advertisements