5

Given already created SQL databases, is there any way to generate the DDL SQL statements to recreate the database?

drum
  • 719

2 Answers2

9

Given that you have tagged phpMyAdmin, just use the export feature for the whole database. You will be given the option to choose a format, and SQL is one of the options.

mysqldump will do the same thing, with many more options.

7

The statement SHOW CREATE TABLE table_name, with table_name being the name of the table you're interested in, will give you the query executed to create the table, on the column Create table, and with SHOW CREATE DATABASE database, you'll have the query to create the database itself.

Combining the two should allow you to get what you want.

Haggra
  • 133
m4573r
  • 5,701