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
Release: 2023-08-24 20:53:02
forward
1222 people have browsed it

如何查看现有 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;
Copy after login

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)
Copy after login

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!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template