00 Votes

MySQL Command to display the Table Structure/Definition

Question by Guest | 2013-10-03 at 21:16

Is there a command in MySQL that allows me to get the entire structure of a table with all names and column definitions?

I have several MySQL tables to copy to another computer and it's totally awkward to specify the new construction with all the names, file types and default values ​​each time again.

ReplyPositiveNegative
0Best Answer0 Votes

Yes, there is a command. Just use "SHOW CREATE TABLE" for this. Here is a small example of how to show the structure of the table "tab":

SHOW CREATE TABLE tab

The result may look like this:

CREATE TABLE tab (
  id INT(11) default NULL auto_increment,
  vname VARCHAR(100) default NULL,
  nname VARCHAR(100) default NULL,
  PRIMARY KEY (id)
) ENGINE=MyISAM

It contains the CREATE TABLE statement to rebuild the structure of the table. 
2013-10-04 at 20:22

ReplyPositive Negative
Reply

Related Topics

Important Note

Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.

Participate

Ask your own question or write your own article on askingbox.com. That’s how it’s done.