MySQL - Duplicate table

前端 未结 2 720
失恋的感觉
失恋的感觉 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:29

    There is also another way to create a empty table as existing table and you can use the following command also

    create table a select * from users2 limit 0, 0;
    
    0 讨论(0)
  • 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).

    0 讨论(0)
提交回复
热议问题