How can I see the CREATE TABLE statement of an existing MySQL table?


We can see the create table statement of an existing table by using SHOW CREATE TABLE query.

Syntax

SHOW CREATE TABLE table_name;

Example

mysql> Show create table employee\G
*************************** 1. row ***************************
Table: employee
Create Table: CREATE TABLE `employee` (
   `Id` int(11) DEFAULT NULL,
   `Name` varchar(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
1 row in set (0.00 sec)

The query above gives the CREATE TABLE statement of ‘Employee’ table.

Updated on: 19-Jun-2020

589 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements