Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

Many to many relationship (noob)


This topic is 4718 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Ok, I guess this is a really basic question so sorry, but I'm not able to find it exactly.

I just want to have 2 tables.

STUDENTS with the typical personal data (name, address, phone, etc)

COURSES with the name of the course, the hours, teacher, etc.

A Student should be able to attend to multiple Courses and also, a Course can have multiple Students. The idea is to show a portal on a presentation for each table.

I know how to make it "one to many" but not both sides.

Thank you very much!

Posted

You need a third table, say Enrollments, where each record is a single instance of a student joining a class. See an example here:

http://www.fmforums.com/forum/showpost.php?post/246136/

Posted

Thanks, this is quite what i'm looking for.

I've taken a look and tried to replicate the scheme but although I create the portals, nothing appears so either is something wrong with the way I did the relationship or the way I called the fields for the portal... :S

Is it necessary that the third (bridge) table has a unique ID field of its own? I haven't done that since in my case that table is more "accessory" than in the example and its ID isn't related with the others...

Done, it works... it was my fault. :idot:

Thanks a lot!

Posted

Is it necessary that the third (bridge) table has a unique ID field of its own?

It's not necessary now - but it's good practice to have a serial ID in every table, because you might need it later.

Posted

Hi standstill,

A unique ID in every table isn't only used if you want to create a relationship. Unique IDs provide ability to update your data in case of crash or other problems. For instance, if a User accidentally changes many fields in a record and Management requests that the values be put back to what they were from the prior backup, it is this unique ID which must be used to match during the import. If you wait until you NEED an ID, it is most often too late.

This is same reason every table should have a creation and modification timestamp ... there will be times that you need to retrieve data according to when it was last modified, or find all records created after a certain point in time.

These three fields should be in every table and it has become one of my rules because of NOT having them and needing them too many times over the years during critical situations. :laugh2:

This topic is 4718 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.