[quoted text, click to view] On Sep 17, 6:44 am, Peter <Pe...@discussions.microsoft.com> wrote:
> I am a newbie and trying to setup a database similar to Northwind with
> Customers, Suppliers and Employees. However, unlike Northwind I want to keep
> all the contact info for each one of these (Customers, Suppliers, Employees)
> in the same table named Contacts ( which I hope to eventually link / sync
> with Outlook). My question is should I be setting up a 1-many or a 1-1
> relationship between the tables and Contacts? What are the pros/cons in
> either case? If 1-1 is the answer then how do I setup a 1-1 relationship?
> (e.g., Customer would have customerid and contactid.. would they both have to
> be primary keys?)
>
> Thanks
> Peter
If you want to put all contacts in one table
Pros
-------------
1. Same schema will be used for all contacts and so format is
standardized for contacts like address1 varchar(50) , email
varchchar(60) etc
2. If you want to expand the columns you can do it in one table and
easy code change .
3. You can use only one table with flag column for Customers,
Suppliers, Employees (CU,SU,EM)
4 If your customer is also supplier , you can keep only one entry
Example
Main table : Customer
CustomerID : 1001 , customername .....
SupplierID : 2001
MultiAddress -- This is a connecting table
MultiID Multicode AddressID
1001 CU 1
2001 SU 2
Address table
AddressID Adress1, Adress2 zip
1 123 goodcity
2 456 verygood city
Cons
----------
1. You are not able to enforce FK relationship from MultiAddress
table to customer/Supplier tables directly. You need to do through
triggers
2. If you don't enforce relationship through triggers , you may end
up into orphan address/wrong addresses
3. Data modification should handled and verified in your code (SP )
Srinivas