Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

many to many relationships

Status
Not open for further replies.

blexman

Programmer
Jul 18, 2001
34
0
0
CA
Is there a generally excepted way of re-designing a table that has many to many relationships ?

c1 c2
1 9
1 9
2 5
3 5
3 9

thanks
hanton
 
The conventional way of providing this is in an RDBMS through three tables: two value tables and an intersect table. In your example, you would have t1 and t2:

t1.c1 t2.c2
1 5
2 9
3

and the intersect table which would look like your current
many-to-many. Of course, this assumes that you have more attributes associated with t1 and t2. One of Oracle's classic examples of this would be customers and sales people (employees). In this case, you can have one employee serving many customers and one customer being serviced by many employees. Rather than replicate the customers' name, address, shoe size etc and the employee's name, hire date, and so forth, your intersect table might consist of the customer's id number, the employee's id number, the date of service, and probably the sales order id number.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top