Duplicate / Copy records in the same MySQL table

前端 未结 9 1045
我在风中等你
我在风中等你 2020-12-04 06:27

I have been looking for a while now but I can not find an easy solution for my problem. I would like to duplicate a record in a table, but of course, the unique primary key

9条回答
  •  温柔的废话
    2020-12-04 07:01

    I needed this as well; my solution was to use SQLYOG (free version) to export the desired record as SQL (creates an insert).

    I then hand edited this to remove the id as this needs to be auto-generated and then copied the insert into SQLYog to execute it. This was painless. I guess plenty of other MySQL GUIs can do this as well.

    This provides me with a record I can use for test purposes on a live system.

    I now have this insert for reuse as well, as the table is rewritten daily.

提交回复
热议问题