![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi all Congratulations for this great group, and first of all, sorry for my bad english... |
|
I'm trying to do a database for a music school. The problem is that I'm really not understanding how the table relationships work. I read the "Filemaker 10 bible" book and the Filemaker help, but that really didn't help much, so I must be really stupid (hehehe). The problem is this: I have several tables (students, teachers, employees, etc) and I want the following feature: when I write a class name ("piano", "flute", etc.) in a student record (table "students" and I choose a teacher name for that class, the student's name, number and grade (in that class) must show up in a list (portal?) at the corresponding teacher's record. Each student may be enrolled in several different classes ("piano", "choir", "music theory", etc) with different teachers (or not) and grades. This would be really perfect if the information at the teacher's record was grouped by class, because each teacher can teach different classes (for example "piano" and "music theory"). Like: "Piano": Student No.1, Student No.2, Student No.3, etc. Music Theory: Student No.1, Student No.4, Student No.5, etc Many thanks in advance Please explain it easily, because I'm soooo confused with this subject... |
#3
| |||
| |||
|
|
On 2010-02-25 18:03:51 -0800, Pianoman <pianoman... (AT) gmail (DOT) com> said: Hi all Congratulations for this great group, and first of all, sorry for my bad english... Your English is perfectly fine, and certainly better than my non-existant Portugese. I'm trying to do a database for a music school. The problem is that I'm really not understanding how the table relationships work. I read the "Filemaker 10 bible" book and the Filemaker help, but that really didn't help much, so I must be really stupid (hehehe). The problem is this: I have several tables (students, teachers, employees, etc) and I want the following feature: when I write a class name ("piano", "flute", etc.) in a student record (table "students" and I choose a teacher name for that class, the student's name, number and grade (in that class) must show up in a list (portal?) at the corresponding teacher's record. Each student may be enrolled in several different classes ("piano", "choir", "music theory", etc) with different teachers (or not) and grades. This would be really perfect if the information at the teacher's record was grouped by class, because each teacher can teach different classes (for example "piano" and "music theory"). Like: "Piano": Student No.1, Student No.2, Student No.3, etc. Music Theory: Student No.1, Student No.4, Student No.5, etc Many thanks in advance Please explain it easily, because I'm soooo confused with this subject... When you read about relationships in FM and the relationship graph, you will often come across the word "Context." *When I first started learning this in FM7, I had to simplify it for myself because I too was terribly confused. *I used a visual metaphor for myself since this is the way I think. I began to think of context as "where I am standing to see the data I want to see." *Then I would list the data I wanted to see, and HOW I wanted to see it. That method, that HOW was the relationship. *And a relationship can only function through a key field or multiple key fields. Those key fields are the window from one table to another. So if I were in a student record, and I wanted to see the classes a student was taking, I would know that somewhere out there was a table of classes. Each student record has a StudentID key field. Each class record has a ClassID key field. Looking at that, I realize that many students can be in each class, and there is no room in the basic Class record for many students. *So a direct link between these two tables won't work. I can't see directly from Students to Classes. This can only mean one thing. There is what is called a Join Table between them. This is a table, perhaps called "Enrollment" where each record contains a StudentID field, and a ClassID field. So if a student is enrolled in 5 classes, they will have 5 enrollment records. Each will have the same StudentID value, but they will each have a different ClassID. When I make the relationship from Student to Enrollment to Classes, I can see the data from both Enrollment AND Classes from where I am "standing" in the Student record. *The Enrollment join table feeds the data from Classes to Students, through this two-jump relationship. *So I can put a portal using this relationship on the Student layout, and see the 5 join table records, each with the name of class that is kept in the Class table. Similarly, I know there must be a table for Teachers. Teachers can teach more than one class (unless they can't in your system) so there is probably a join table between Teachers and Classes, perhaps called Sections, where each record has a TeacherID, and a ClassID. Or you could have multiple teachers teaching the same class at different times, so that also requires a join table to exist. From a Teacher record you will be able to show the classes they teach. From a Class record you will be able to show the teachers who teach it, and the students enrolled, all in portals. When I select a class for a student, I will want to bring across the correct TeacherID as well, so I know *which* class they're enrolling for. Perhaps there is a section number you can include in the value list to help you choose. The TeacherID would have to live in the Enrollments join table, and from that same record, you can link Students to Enrollment to Sections to Teachers, and pull that Teacher name from that 3-jump relationship. Remember that the Section table will also have a SectionID. In this case, the key fields used on each side would be: Student::Enrollment using StudentID Enrollment::Sections using SectionID Sections::Teachers using TeacherID Get this arrangement of tables and relationships set up on your graph, as described. Make up some student, teacher, and class records and make some manual join records for Enrollment and Sections by copying and pasting your IDs into new records. Don't worry for now as to HOW you will select the classes or teachers for a student. Then show the data in portals on your Student, Teacher, and Class layouts. Once you get this working and start to understand it, come back to us and we'll work on how to make selections for your system. -- Lynn Allen --www.semiotics.com Member FBA FM 10 Certified Developer |
#4
| |||
| |||
|
|
Hi all Congratulations for this great group, and first of all, sorry for my bad english... I'm trying to do a database for a music school. The problem is that I'm really not understanding how the table relationships work. I read the "Filemaker 10 bible" book and the Filemaker help, but that really didn't help much, so I must be really stupid (hehehe). The problem is this: I have several tables (students, teachers, employees, etc) and I want the following feature: when I write a class name ("piano", "flute", etc.) in a student record (table "students" and I choose a teacher name for that class, the student's name, number and grade (in that class) must show up in a list (portal?) at the corresponding teacher's record. Each student may be enrolled in several different classes ("piano", "choir", "music theory", etc) with different teachers (or not) and grades. This would be really perfect if the information at the teacher's record was grouped by class, because each teacher can teach different classes (for example "piano" and "music theory"). Like: "Piano": Student No.1, Student No.2, Student No.3, etc. Music Theory: Student No.1, Student No.4, Student No.5, etc Many thanks in advance Please explain it easily, because I'm soooo confused with this subject... Pianoman (Portugal) |
#5
| |||
| |||
|
|
you want to look into many-to-many relationships. each student might follow many classes each class might have many students to accomplish this you need a many-to-many relationship (mtm) to manage a mtm you need an extra table, called the join-table in this case you could call it the student_class table It would hold 2 fields you already have pk_studentID and pk_classID which are auto-generated primary keys (pk) for each table the join table would have the fiels sk_studentID and sk_classID (sk = secondary key) these need to be the same type as the pk fields inside the relationgraph join student: k_studentID tostudent_class::sk_studentID & class: k_ck_classID tostudent_class::sk_classID When you want to assign a student to a class you create a new record in the join table (student_class) then assign pk_studentID to sk_studenID and pk_classID to sk_classID All this is best scripted to counter any errors with the record created you now will be able to create a layout for the Student table create a portal for student_class and put inside this a field from class (like name or something similar) the relationship starting at student will look 'through' student_class and find all connected classes (also true the other way around) Hope this will get you going -- Keep well / Hou je goed Ursus "Pianoman" <pianoman... (AT) gmail (DOT) com> schreef in berichtnews:267f8f43-fa70-446d-8560-1fb37cba19be (AT) t23g2000yqt (DOT) googlegroups.com... Hi all Congratulations for this great group, and first of all, sorry for my bad english... I'm trying to do a database for a music school. The problem is that I'm really not understanding how the table relationships work. I read the "Filemaker 10 bible" book and the Filemaker help, but that really didn't help much, so I must be really stupid (hehehe). The problem is this: I have several tables (students, teachers, employees, etc) and I want the following feature: when I write a class name ("piano", "flute", etc.) in a student record (table "students" and I choose a teacher name for that class, the student's name, number and grade (in that class) must show up in a list (portal?) at the corresponding teacher's record. Each student may be enrolled in several different classes ("piano", "choir", "music theory", etc) with different teachers (or not) and grades. This would be really perfect if the information at the teacher's record was grouped by class, because each teacher can teach different classes (for example "piano" and "music theory"). Like: "Piano": Student No.1, Student No.2, Student No.3, etc. Music Theory: Student No.1, Student No.4, Student No.5, etc Many thanks in advance Please explain it easily, because I'm soooo confused with this subject... Pianoman (Portugal) |
#6
| |||
| |||
|
|
On 26 Fev, 22:35, "Ursus" <ursus.k... (AT) ziggo (DOT) nl> wrote: you want to look into many-to-many relationships. each student might follow many classes each class might have many students to accomplish this you need a many-to-many relationship (mtm) to manage a mtm you need an extra table, called the join-table in this case you could call it the student_class table It would hold 2 fields you already have pk_studentID and pk_classID which are auto-generated primary keys (pk) for each table the join table would have the fiels sk_studentID and sk_classID (sk = secondary key) these need to be the same type as the pk fields inside the relationgraph join student: k_studentID tostudent_class::sk_studentID & class: k_ck_classID tostudent_class::sk_classID When you want to assign a student to a class you create a new record in the join table (student_class) then assign pk_studentID to sk_studenID and pk_classID to sk_classID All this is best scripted to counter any errors with the record created you now will be able to create a layout for the Student table create a portal for student_class and put inside this a field from class (like name or something similar) the relationship starting at student will look 'through' student_class and find all connected classes (also true the other way around) Hope this will get you going -- Keep well / Hou je goed Ursus "Pianoman" <pianoman... (AT) gmail (DOT) com> schreef in berichtnews:267f8f43-fa70-446d-8560-1fb37cba19be (AT) t23g2000yqt (DOT) googlegroups.co m... Hi all Congratulations for this great group, and first of all, sorry for my bad english... I'm trying to do a database for a music school. The problem is that I'm really not understanding how the table relationships work. I read the "Filemaker 10 bible" book and the Filemaker help, but that really didn't help much, so I must be really stupid (hehehe). The problem is this: I have several tables (students, teachers, employees, etc) and I want the following feature: when I write a class name ("piano", "flute", etc.) in a student record (table "students" and I choose a teacher name for that class, the student's name, number and grade (in that class) must show up in a list (portal?) at the corresponding teacher's record. Each student may be enrolled in several different classes ("piano", "choir", "music theory", etc) with different teachers (or not) and grades. This would be really perfect if the information at the teacher's record was grouped by class, because each teacher can teach different classes (for example "piano" and "music theory"). Like: "Piano": Student No.1, Student No.2, Student No.3, etc. Music Theory: Student No.1, Student No.4, Student No.5, etc Many thanks in advance Please explain it easily, because I'm soooo confused with this subject... Pianoman (Portugal) Thanks Ursus. I've been doing some tests after reading both answers. I think I'm going somewhere with classes and students. Now I'm off to teachers. The process is similar, right? Just one question: why do I need to have auto-generated pks and sks for the ClassID? couldn't they be text (the class name like "piano", "flute", etc.) Thanks again Pianoman (Portugal) |
#7
| |||
| |||
|
#8
| |||
| |||
|
|
Teacher: Pianoman Class: Piano "Student no.1" grade 2, classroom 3, Sunday, 10:00 "Student no.2" grade 4, classroom 3, Sunday, 11:00 "Student no.3" grade 5, classroom 3, Sunday, 12:00 Class: Choir practice "Student no.4" grade 1, classroom 1, Monday, 15.00 "Student no.2" grade 1, classroom 1, Monday, 15.00 "Student no.5" grade 1, classroom 1, Monday, 15.00 "Student no.3" grade 1, classroom 1, Monday, 15.00 Any help? |
#9
| |||
| |||
|
|
I think I have the Student part working OK already. Thanks again for all your help. Now I need to do the Teacher part, but I'm not still able to figure out which relations I need. This is the situation I want: Each Teacher might teach several classes (Piano, Music Theory, Choir, etc) Each Student might (and probably) have many different teachers (piano teacher, Choir practice teacher, etc) Each teacher might (surely) have many students Some Classes are individual (any of the instruments) Some Classes are collective (Music Theory, Choir Practice) I want to list the students that each teacher has, grouped by class subject and sorted by weekday and time with some extra informations like grade, number, classroom, etc. for example: Teacher: Pianoman Class: Piano "Student no.1" grade 2, classroom 3, Sunday, 10:00 "Student no.2" grade 4, classroom 3, Sunday, 11:00 "Student no.3" grade 5, classroom 3, Sunday, 12:00 Class: Choir practice "Student no.4" grade 1, classroom 1, Monday, 15.00 "Student no.2" grade 1, classroom 1, Monday, 15.00 "Student no.5" grade 1, classroom 1, Monday, 15.00 "Student no.3" grade 1, classroom 1, Monday, 15.00 Any help? Many thanks in advance Pianoman (Portugal) |
#10
| |||
| |||
|
|
Teacher: Pianoman Class: Piano "Student no.1" grade 2, classroom 3, Sunday, 10:00 "Student no.2" grade 4, classroom 3, Sunday, 11:00 "Student no.3" grade 5, classroom 3, Sunday, 12:00 Class: Choir practice "Student no.4" grade 1, classroom 1, Monday, 15.00 "Student no.2" grade 1, classroom 1, Monday, 15.00 "Student no.5" grade 1, classroom 1, Monday, 15.00 "Student no.3" grade 1, classroom 1, Monday, 15.00 Any help? you work your way down from left to right. Create a layout based on the most left item, being the teacher. Then create joine-tables or relatations as needed. Teacher::teacher_class::class::class_student::stud ent::student_classroom::clas sroom::classroom_day::day But before you go and create massive amounts of relationships a bit of warning is in place. If you just go ahead you will end up with a relationship graph looking much like a spider (therefore called a spider graph, sometimes also chaotic-graph). These a very difficult to work with as they get larger and larger. But there a a couple of other ways to go about that you need to learn first. And I would like to urge you to take the trouble before your product is finished. Once you have made a choice it will be very difficult to change your ways. So please read the approach on graph modelling. found at: http://developer.filemaker.com/conte..._graph_modelin g_en.pdf Try them out and make a better choice (probably a mix between squid and chaotic in your case) It will take some time and trouble but imho it is really worth the trouble. |
![]() |
| Thread Tools | |
| Display Modes | |
| |