MySQL Forums :: PHP :: Help: Table & Data management
Help: Table & Data management
Posted by: Murat Yilmaz
Date: August 10, 2013 02:45PM
Hi I'm learning mysql in combination with mysql since 2 Months and have now a problem, where i don't know how i should solve it best.
Short Database Snipped:
Table "Profile" ( ID, ADDRESS_ID, ADDRESS_ID_2, ... )
Table "Address" ( ID, ... )
Table "Company" ( PROFILE_ID, ADDRESS_ID, ... )
Now my problem is at the beginning if some one creates a Profile.
The Table "Address" gets a new Entry if necessary and then i save the ID at:
Profile.ADDRESS_ID, Profile.ADDRESS_ID_2, Company.ADDRESS_ID
Now if the user changes the ADDRESS_ID_2 or Company.ADDRESS_ID i have to make many kind of checks ...
Starting with Reference Counting for each table if other fields use this address,
if i have to split up these address from the other Profile ADDRESS_ID,
if i have to remove this entry if no one else is pointing to it etc. etc.
Now i wanted to ask if there is a better solution for this problem?
Main functionality should be like this:
if Profile.ADDRESS_ID is changed check if new entry exist & change ID, if company address & second address is same change their ID too.
if the other ones are changed and id is same as the main address then add new entry and split this one up from the mail ID...
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.