I have many examples of this through my database. Below is a simple example you may be able to lend assistance with.
I have an Image table
image_src
street_number
steet_name
postcode
county
country
camera_used
title
description
date_time_taken
user_id
My question is to prevent duplicate data from being added such as camera which could be the same camera for multiple image I thought it best to separate the table.
However if a user then updates the camera in the camera_used table the id in each record would correspond to the updated camera across all images. Same situation with the address.
If this instance is it best to perform a check before the update to see if any other tables reference the id and if so create an insert if not update the record.
The situation is one user updates the camera, another uses think thats not my camera updates the record and back and to we go. Just was unsure if this the best way with one to many.
Image table at present
Don’t allow users to update the
cameratable, at least not directly.What they can do is update the camera used for their specific image which either finds the correct entry in
cameraor creates a new one. You don’t want to allow them to change thecameratable directly at all or else it will change thatcamerafor all images, as you indicated.