Rasshu
Rasshu

Reputation: 1799

Retrieve CREATE TABLE code of an already existing table?

Is there a way to do this?

In case the DBMS command history got cleaned or, in my case, when many ALTER TABLE were used in the course of time.

I'm using MySQL.

Upvotes: 1

Views: 158

Answers (1)

Michael Berkowski
Michael Berkowski

Reputation: 270637

Yes, it is as simple as

SHOW CREATE TABLE yourtable;

This will include all the subsequent ALTER TABLE statements. You cannot retrieve the table's original state.

Here is the relevant documentation

Upvotes: 6

Related Questions