Create table in MySQL that matches another table?

后端 未结 4 808
鱼传尺愫
鱼传尺愫 2020-12-07 16:33

I am using MySQL. I have a table called EMP, and now I need create one more table (EMP_TWO) with same schema, same columns, and same constraints. How can I do this?

4条回答
  •  醉梦人生
    2020-12-07 16:41

    If you want to copy only Structure then use

    create table new_tbl like old_tbl;
    

    If you want to copy Structure as well as data then use

    create table new_tbl select * from old_tbl;
    

提交回复
热议问题