I am curious about the REPLACE INTO statement in MySQL. I am currently using it as follows and I want to make sure I am using it correctly.
I have a historical table with 3 million-plus records. Then I have a staging table that will pull data down from an API daily and then run a replace statement into the historical table from the new data that came in. The new data coming in will be as follows:
What I expect to happen:
Is my assumption correct that my update process is working as expected?
The only thing that made me question the process is I made a change on the API level to ingest data that I thought was coming through and exposing it but it wasn't. It now is. When I checked the staging and historical tables this morning I would have expected the data to be updated for the fields that were missing data and do not see it updated.
My primary key is called repair_order_id and the records I am pulling down are based on a date called updaed_date which will show the latest records that are new or updated.