
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
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.
- Related Articles
- How can we create a table from an existing MySQL table in the database?
- How can I drop an existing column from a MySQL table?
- Create MySQL query to create a table from an existing table?
- How can I change the name of an existing column from a MySQL table?
- Which statement, other than ALTER TABLE statement, can be used to apply UNIQUE constraint to the field of an existing MySQL table?
- How to generate a “create table” command based on an existing table in MySQL?
- How can we have multiple virtuals GENERATED COLUMNS in MySQL table with CREATE TABLE statement?
- How can we create a new MySQL table by selecting specific column/s from another existing table?
- How can we apply UNIQUE constraint to the field of an existing MySQL table?
- How can we get more details about columns of an existing table than return by MySQL SHOW COLUMNS statement?
- How can we get a list of columns in an existing MySQL table?
- How can we delete an existing MySQL table by using PHP script?
- How can we set PRIMARY KEY on multiple columns of an existing MySQL table?
- How can we apply the PRIMARY KEY constraint to the field of an existing MySQL table?
- How to add columns to an existing MySQL table?

Advertisements