|
|
|||||||||
|
|||||||||
|
|||||||||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
I'm having a little problem with the normalization of the db I'm trying to setup for my website. (for a tradinghouse)
I have two entities Product (product data) and Contact (a table of company data (name, phone, address etc) of customers, supplier etc.)) One Product attribute is supplierID and another eventually customerID so that means two relations between the two tables. I can even think of a third relation namely locationID (location of product) How do you describe such a relation (1 to many) or (many to many) or just 3 (1 to many) relations. I don't know enough of this normalization theory maybe there is someone around that can help me a bit. Regards TheMike |
|
#2
|
|||
|
|||
|
Well a one-to-one relationship is the typical primary to foreign key link. One-to-many infers that one field is related to multiple tables, for example, like this:
people ________ personId name age groups ________ groupId groupName personId groupMembers ___________ gmId groupId personId IN the tables above, the personId table has a one-to-many relationship because its personId field ties it in with the groups table. Its personId field ties it with the groupsMembers table also. If you're interested in learning more about database normalization then see these links: http://www.wdvl.com/Authoring/DB/Normalization/ http://www.phpbuilder.com/columns/barry20000731.php3 http://www.swynk.com/friends/faour/databasedesign1.asp |
|
#3
|
|||
|
|||
|
Quote:
personId does not belong to this table. It is clearly just a typo |
|
#4
|
|||
|
|||
|
The links arew good, but the example is more confusing than good between the typo (sylow noticed) and bad info. People and Groups clearly have a MANY to MANY relationship via an intermediary table (to which they have one to many relationship). This is good normalization of a many to many but just not labelled properly. One to many is not indicative of the number of tables linked, but the number of related records in the other table to which the relationship is referring.
From the description of the problem itself, I couldn't clearly answer the question at hand either... Just wanted to caution on the previous info in the thread. |
|
#5
|
|||
|
|||
|
1 to 1 is
PK to PK 1 to many is PK to FK many to many is Pk to Linking Tables's FK and Linking Tables's FK to PK (has 3 tables) so Table 1 | Table 2 | Table 3 ID1 ->>> ID1 ID2 ->>> ID2 Table 2 is the linking table
__________________
Regards, James Yang .NET Developer / Network Engineer MCSE, MCDBA, MCSA, CCNA http://www.yellowpin.com/ http://www.opentechsupport.com/ |
![]() |
| Viewing: Dev Articles Community Forums > Programming > Programming Tools > DB Nomalization question |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|