Tables - joining (1 Viewer)

Tech

Registered User.
Local time
Today, 15:51
Joined
Oct 31, 2002
Messages
267
hi there.

in our class (not really databases) we are asked to do a piece of coursework which involves entity relationship etc... and identifying key table names and fields etc...

now - if there is a many to many relationship in our diagram we have to somehow split it up so its a 1 to many - another entity is made to join the 2 tables together.


i found one - Manufacturing Run and Gas container are a Many to Many - so i split them up to a Table called Usage.

as for the entry fields - what should be in it?

it would contain (i assume)

Manufacturing Run (which is in the Manufacturing table)
Container No (which is in the Gas Container table)
..
..

what else?

as for the Gas component table - i have these fields:

Container No.
Specification
Capacity
Critical Pressure Limit
Container Name


would this do? or do i also have to put in the Manufacturing Run No.? - i dont think i do hence why we have the usage table to link them up

correct? :)

Thanks :)
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 10:51
Joined
Feb 19, 2002
Messages
43,632
The relation table that links two tables which have a many-to-many relationship contains at a minimum two columns. Those being the primary key of each of the related tables. Depending on your data needs, this table may contain addional information that is dependent on BOTH of the key fields. An example of this would be a StudentClasses table that contains the StudentID from the Student table and the ClassID from the Class table. But additional information is required here. We need to know the semester the student took this class and this must also become part of the key because a student may retake a class if he fails the first time. This table may also include a final grade as a data colum.

I posted a sample many-to-many db some time ago. Search the archives for man-to-many and my name to find it.
 

Users who are viewing this thread

Top Bottom