Generate table DDL via query on MySQL and SQL Server
it's mysql-specific, but SHOW CREATE TABLE <table-name>
gives you the DDL for a table.
You can't get the CREATE Table
text in a cross platform way, but you can get enough information to build it yourself from the INFORMATION_SCHEMA
views.
You have to create that yourself.
You can query INFORMATION_SCHEMA.COLUMNS
for the column name and data type.