Copy table structure into new table

前端 未结 5 552
予麋鹿
予麋鹿 2020-12-07 14:30

Is there a way to copy the structure of a table into a new table, without data, including all keys and constraints?

5条回答
  •  庸人自扰
    2020-12-07 14:47

    For a simple schema copy use the like clause.

    CREATE TABLE new_table_name ( like old_table_name including all)
    

提交回复
热议问题