开发者

Saving MySQL records as a series of Insert Statements

开发者 https://www.devze.com 2022-12-23 00:51 出处:网络
Having carefully and painfully manually populated/manipulated a series of records in a table, I want to retain them for reuse. As the table is rewritten daily I\'d like to save JUST these particul开发

Having carefully and painfully manually populated/manipulated a series of records in a table, I want to retain them for reuse. As the table is rewritten daily I'd like to save JUST these particul开发者_C百科ar records as a series of "inserts". The only way I know how to do this is to dump the whole table as sql using a GUI eg sqlyog.

But is there any quicker/better way to do this?


would mysqldump help ? (it's not a GUI)

edit : note that you can save only part of a table using this tool. since it's command line, you can automate the task easily.


Create a copy of your table with a meaningful name and copy using a INSERT the records your interested in.

Doing it this way gives the most flexibility should you need to copy them back/compare them.


Providing you still have your clean manually populated table available. Copy it into another table:

CREATE TABLE mytable_backup SELECT * FROM mytable;

Then you can re-introduce these to your daily rebuild table using a similar method:

INSERT INTO mytable SELECT * FROM mytable_backup;

Does this help?

0

精彩评论

暂无评论...
验证码 换一张
取 消