Desc table :
We can examine the structure of a table using the DESCRIPTION or DESC statement. The following query describes the structure of the student table.
mysql> desc student;
+---------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+-------------+------+-----+---------+-------+
| studid | int(10) | YES | | NULL | |
| name | varchar(20) | YES | | NULL | |
| address | varchar(40) | YES | | NULL | |
| phone | int(10) | YES | | NULL | |
+---------+-------------+------+-----+---------+-------+
4 rows in set (0.00 sec)
We can also use the SHOW FIELDS FROM statement to display the same structure.
mysql> SHOW FIELDS FROM student;
Listing Tables :
We can list all the tables in the database using SHOW TABLES query. The following query will list the tables in the current database.
mysql> show tables;
+--------------------+
| Tables_in_sample |
+--------------------+
| student |
+--------------------+
1 row in set (0.00 sec)
|