I am attempting to create database for contacts I want for each contact to possess many catogries Like home Office Emails Phones As well as in every category can also add more one value Even the groups could be dynamic How is this developed in database
It appears in my experience you have 2 kinds of categorization you need to be worried about. First you will find the reason for the contact, i.e. Office or home (there might be others, for example Hq, Emergency Contact, Vacation Home,...) and also the other may be the medium from the contact, i.e. E-Mail, Phone (there might be others here too, for example Rim PIN, FAX, Mailing Address, Delivery Address,...)
Within the first situation you need to describe how or why the contact can be used as well as in the 2nd situation you need to describe what medium can be used to create contact.
These should be thought about individually because they will drive different application functions. For instance, you may have some GUI code that presents different fields and enforce different edits based on regardless if you are taking a mailing address versus a postal address versus a telephone number, etc. Similarly, you may have business rules that say Office contact is required and residential contact is optional.
This is a quick sketch of schema that enables you to definitely make these categorizations:
The Client table (with regard to illustration) consists of the folks you need to have the ability to contact. The CONTACT table consists of the particular information required to contact the client. You could utilize a normal design or something like that like XML data to structure this based on your requirements. The two kinds of categorizations are table driven the following:
CONTACT_PURPOSE informs you why the contact could be used. Here's your Home/Office/... categorization. Chiefly a research table however it may have some rules onto it like set up contact is required.
CONTACT_FORMAT informs the structure from the contact. Here's your E-Mail/Phone/Address/... categorization. This can possess a research table element into it, however it may also contain rules based on how the contact information is structured, like the number of fields? How large is each area? What's the regex pattern accustomed to validate the contact content and so on.
Contact( ID, FirstName, LastName, ..)
Category( ID, Title)
You'd require a default category since within this design you can't give a number with no category.
Good explanation by @Joel Brown, I'd much like to include.
This Content in touch could be another table with respect to the CONTACT_FORMAT, for instance,
1) when the CONTACT_FORMAT is Address, it can make reference to ADDRESS table that will have fields like street, city, condition, country etc.
2) when the CONTACT_FORMAT is Phone, it can make reference to PHONE table that will have fields like request for, good time for you to call, area code, country code etc.
like so for various CONTACT_FORMAT's which needs specific fields.