MySQL - Duplicate table

前端 未结 2 724
失恋的感觉
失恋的感觉 2020-12-28 12:39

I need to duplicate a table in MySQL, making the new table empty. That is, I need to copy only the structure of an existing table to a new one.

2条回答
  •  情深已故
    2020-12-28 13:33

    Try the create table LIKE syntax.

    create table users2 like users; 
    

    This should give you an empty table (users2) with the same structure as the original (users).

提交回复
热议问题