Here is a part of our Database:
Table: Users ID INT First Name VARCHAR Last Name VARCHAR Email Address VARCHAR ... Table: Contacts ID INT User_id INT (Foreign Key) First Name VARCHAR Last Name VARCHAR Email Address VARCHAR (Unique) Phone Number VARCHAR Address VARCHAR ...
user can have multiple
contacts (One-to-many relationship).
It is possible that a
contact of one
user is also a
contact of another
user. And the second user may try to enter different
address (but same
email address). I cannot allow duplicate email addresses.
One possible solution is to split contacts table into 2 tables:
Table: Contacts ID INT Email Address VARCHAR ... Table: Contact_attributess ID INT User_id INT (Foreign Key) Contact_id INT (Foreign Key) First Name VARCHAR Last Name VARCHAR
Is this the best way to reorganize my DB? Do you have other solutions?