In a database called TEST I have a table called CULTIVES in which one of its fields is a numeric type and is called PID.
This table has this structure:
mysql> DESCRIBE CULTIVOS;
+----------+------------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+------------------------+------+-----+---------+-------+
| PID | smallint(9) unsigned | NO | PRI | 0 | |
| datetime | decimal(13,0) unsigned | NO | PRI | 0 | |
| value | float | NO | | 0 | |
+----------+------------------------+------+-----+---------+-------+
The table contains thousands of lines with PID = 37. And I have passed some data on the crop 37 that supposedly correct those that are currently in the database that are wrong. There are lines that the datetime is wrong, lines where the value is wrong, lines with both wrong and lines with both well. The information I have received is complete, if I remove what was there and add the new, everything is supposed to be fine.
With what my plan is to erase the current data with PID = 37 with:
DELETE FROM CULTIVOS WHERE PID=37;
Then add the thousands of lines with the data that have happened to me and then the staff that takes care of this will tell me if it's okay or I'll go back.
To go back I need a backup but I can not do it from the whole table because:
- It has hundreds of millions of lines. And as always, this is in a hurry.
- The table will continue to be used and if it is decided to go back, I can only backtrack the data with PID = 37, not the rest of the table.
How do I back up the table that contains only the rows with PID = 37?