I'm wondering what is the best way to deal with recording/storage of peoples addresses.
Scenario:-
Table1:CONTACTS
conId
addressId (FK)
fname
sname
etc
Table2:ADDRESS
addressId
addressLine1
addressLine2
town
county
poCode
1) A contact may or may not have an address.
2) A contact will only have one address.
3) More than one contact can have the same adddress.
Problem:-
How can a contact record be created without first checking to see if an address is already held for them. Logical order of data entry would be to enter the contact details first or at the same time as the address.
How would you check to see if an adress detail being entered does already exist so a to return its ID to be inserted with the contact record. Addresses can be the same but may be entered differently (ie. abreviations used).
How could you amend an address for a contact, which is shared by another contact but whos address should not be altered.
I'm thinking it would be better to store the addresses in the contact table but I think this goes against normalisation rules?
This is hurting my head now!
Please does anyone have any suggestions? (nice ones only!!)
Thanks
Scenario:-
Table1:CONTACTS
conId
addressId (FK)
fname
sname
etc
Table2:ADDRESS
addressId
addressLine1
addressLine2
town
county
poCode
1) A contact may or may not have an address.
2) A contact will only have one address.
3) More than one contact can have the same adddress.
Problem:-
How can a contact record be created without first checking to see if an address is already held for them. Logical order of data entry would be to enter the contact details first or at the same time as the address.
How would you check to see if an adress detail being entered does already exist so a to return its ID to be inserted with the contact record. Addresses can be the same but may be entered differently (ie. abreviations used).
How could you amend an address for a contact, which is shared by another contact but whos address should not be altered.
I'm thinking it would be better to store the addresses in the contact table but I think this goes against normalisation rules?
This is hurting my head now!
Please does anyone have any suggestions? (nice ones only!!)
Thanks