Name

SHOW CREATE TABLE

Synopsis

SHOW CREATE TABLE table

Use this statement to display an SQL statement that can be used to create a table like the one named. The results may be copied and used with another database. They also could be copied and the name of the table modified so that the statement may be used on the same database.

SHOW CREATE TABLE programmers\G
*************************** 1. row ***************************
Table: programmers
Create Table: CREATE TABLE `programmers` (
              `prog_id` varchar(4) NOT NULL default '',
              `prog_name` varchar(50) NOT NULL default '',
              PRIMARY KEY  (`prog_id`)
              ) ENGINE=MyISAM DEFAULT CHARSET=latin1

Notice that the results include the table type and other default options.

Get MySQL in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.