Given a simplified example of two tables
table Contact(ID int primary key, Name text not null) table ContactPhone(ContactID int not null, PhoneNumber text not null)
Is there a way to tell MySQL that the
ContactPhone.ContactID field is referencing the Primary Key of
Can there be automatic handling? If the Contact is deleted, then relevant
ContactPhone.ContactID should be set to zero.
Ideally this flag/code/operation should be attached to the
ContactPhone table. This way existing software that interacts with the
Contact table can keep on the way it is, and the
ContactPhone table and related software can be added or removed as one unit, without the necessity of altering the
Specifically I want to be able to be able to empty out the
Contact table, reset the
=1, and bring in new
Contacts AND I don't want to have to tell this program anything about
ContactPhone. I want it to be automatic.