standstill Posted February 22, 2012 Posted February 22, 2012 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!
comment Posted February 22, 2012 Posted February 22, 2012 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/
standstill Posted February 22, 2012 Author Posted February 22, 2012 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. Thanks a lot!
comment Posted February 22, 2012 Posted February 22, 2012 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.
LaRetta Posted February 22, 2012 Posted February 22, 2012 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:
standstill Posted February 22, 2012 Author Posted February 22, 2012 I'll definitley add them then. Thanks for the advice, I appreciate it. ;)
comment Posted February 23, 2012 Posted February 23, 2012 Unique IDs provide ability to update your data in case of crash or other problems. :goodpost:
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now