Beginner: Many to Many Relationships

P

Peter

Hello,

Thanks for reviewing my question. I would like a little
help understanding what I actually do with a junction
table. I understand to create a junction table you take
the primary keys from each of table and put them into the
third table. OK - then what do I do - use the junction
table for my queries? (This is the part I don't
understand.)

Many Thanks
Peter
 
T

Tim Ferguson

I would like a little
help understanding what I actually do with a junction
table.

Students
========
Eric
Samantha
George

Classes
=======
Maths
English
Welsh

Attends <----- the "junction" table
=======
Eric Maths
Samantha English
Samantha Welsh
George English
George Welsh

Therefore Eric does only Maths, Samantha takes English and Welsh, and so
does George. This is hugely simplified: in a real world example, the names
would likely be replaced by codes or numbers and there would be extra
fields like
Students(LName, Address, BankAccount);
Classes(DateStart, Cost, ChiefLecturer); and
Attends(RegisteredDate, HasPaid, FinalGrade)
and so on.

Hope that helps


Tim F
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top