Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

converting 'describe' into 'create table' in MySQL?

Can we get a 'create table' command from description (describe )? I have a table whose description I can get from "DESC TableName". I wish to know if I can get how that table was created (so that I can use the same command for something else)?. I can get sql-dump but I want to know if there is another way. Thanks in advance !

like image 343
user2987346 Avatar asked Dec 08 '22 11:12

user2987346


2 Answers

Try this :::

Show create table tableName
like image 98
Sashi Kant Avatar answered Dec 11 '22 08:12

Sashi Kant


If you are looking to make a new empty table with the same structure and attributes, you can use:

CREATE TABLE newTable LIKE tableName

create table reference

like image 33
Tom Fenech Avatar answered Dec 11 '22 08:12

Tom Fenech