简体   繁体   中英

SQL query output to SQL query

How is it possible to have the result of an sql query saved as another sql query, so that somewhere down the line , if a delete is made, it could be reverted back to the old data?

I was looking into making a system call. Something like this

system (mysql -uuser-ppassword -Ddatabase < select.sql > backup.sql

where select.sql is the intial query, and backup.sql is the final query. When i execute it, just get a datadump in backup.sql

Please Help

Try using SQLyog ( http://www.webyog.com/ ) to export a table as a series of insert statements. This should do what you want, although I'm not totally sure that it can export the results of a select statement with a where clause. It will allow you to choose which columns to export.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM