Home >Database >Mysql Tutorial >How do I view the CREATE TABLE statement for an existing MySQL table?

How do I view the CREATE TABLE statement for an existing MySQL table?

WBOY
WBOYforward
2023-08-24 20:53:021210browse

如何查看现有 MySQL 表的 CREATE TABLE 语句?

We can use SHOW CREATE TABLE query to view the table creation statements of existing tables.

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 above query gives the CREATE TABLE statement for the "Employee" table.

The above is the detailed content of How do I view the CREATE TABLE statement for an existing MySQL table?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete