display table in mysql code example

Example 1: mysql show table structure

DESCRIBE table_name; # To show table structure...

Example 2: show table mysql

# First, select your database
USE yourDb;

# Then, simply
SHOW TABLES;

Example 3: mysql show tables in database

show tables;

Example 4: show table info mysql

Copied mysql> DESCRIBE pet;
+---------+-------------+------+-----+---------+-------+
| Field   | Type        | Null | Key | Default | Extra |
+---------+-------------+------+-----+---------+-------+
| name    | varchar(20) | YES  |     | NULL    |       |
| owner   | varchar(20) | YES  |     | NULL    |       |
| species | varchar(20) | YES  |     | NULL    |       |
| sex     | char(1)     | YES  |     | NULL    |       |
| birth   | date        | YES  |     | NULL    |       |
| death   | date        | YES  |     | NULL    |       |
+---------+-------------+------+-----+---------+-------+

Tags:

Misc Example