Generate table DDL via query on MySQL and SQL Server

前端 未结 3 533
别那么骄傲
别那么骄傲 2021-02-11 16:41

Is there an easy way to extract table DDL information, via a query, using either Ms or My SQL server? (preferably both?)

For example, using MySQL Administrator / Navica

相关标签:
3条回答
  • 2021-02-11 16:50

    You have to create that yourself.

    You can query INFORMATION_SCHEMA.COLUMNS for the column name and data type.

    0 讨论(0)
  • 2021-02-11 16:59

    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.

    0 讨论(0)
  • 2021-02-11 17:05

    it's mysql-specific, but SHOW CREATE TABLE <table-name> gives you the DDL for a table.

    0 讨论(0)
自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题