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

MySQLMySQLi Database

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.

raja
Published on 19-Feb-2018 08:15:42
Advertisements