0

I have a general question about inserting elements / updating current state of a database that follows an entity relationship design. Assume we have this design: https://www.visual-paradigm.com/VPGallery/img/datamodeling/EntityRelationshipDiagram/Entity-Relationship-Diagram-Sample.png.

Assume that everything is automated on a different platform, but we need to save it in our DB for archive purposes. Every week I get an update csv about new customers that have joined our company, all the orders and any new products that are added in the store. Can I do the following procedure while keeping the entity relationship model intact?

  1. Truncate products and add new products file
  2. Append new users
  3. Append new orders

Can I truncate the product table without interfering with FK and PK? Notice that every query should be in SQL, the updating as well.

  • I already found this question to be helpfull for users that changed their name: https://stackoverflow.com/questions/4205181/insert-into-a-mysql-table-or-update-if-exists. However my question about updating interfering with the entity-relationship model still stands. – VolatilitySmile Oct 06 '20 at 10:27

0 Answers0