|
|
|
|
![]() ![]() |
Jul 28 2006, 12:24 PM
Post
#1
|
|
|
Premium Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 190 Joined: 21-October 05 Member No.: 13,185 |
Please help me. I'm building a group of database fro a program.
the situation is like this: 'user' may have 1 or more class(es). 'class' itself may have 1 or more user in its classroom. I'm bad at explaining... maybe like this: A program is made to write data of classroom. Hikaru has a math class at Monday and statistic class at Tuesday. The math class itself consists of about 50 students in a classroom. So, Hikaru (user ) may have one or more class at time, math class (class) may have one or more students at time. So, basically I must make these two tables joined together. It is (many-to-many) relation in which I haven't known how to build. So, please tell me how I build these two tables. Thanks in advance. |
|
|
|
Jul 28 2006, 02:00 PM
Post
#2
|
|
|
Newbie ![]() Group: Members Posts: 2 Joined: 28-July 06 Member No.: 27,425 |
Hi, your best option is to add the third table to handle the many to many relationships.
You have basically two options, first is allowing multiple identical links. In that case you should have three fields in the table, numerical primary key, student id and class id. Otherwise the relationship table should consist of at least two fields, Class ID and Student ID, which combined form the unique key for each entry. CODE |ASSIGNEMENT| |STUDENT| |-----------| |-------| |ASGN_ID | |CLASS | |ST_ID |------|ST_ID | |--------| |CLASS_ID |------|CLASS_ID| This post has been edited by eirikureiriksson: Jul 28 2006, 02:19 PM |
|
|
|
Jul 28 2006, 02:32 PM
Post
#3
|
|
|
Premium Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 190 Joined: 21-October 05 Member No.: 13,185 |
so, the third one. Hm... I'll try to take your advice. Thank you. Tomorrow I'll ask again if I'm still in trouble.
|
|
|
|
Aug 3 2006, 12:55 AM
Post
#4
|
|
|
Premium Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 190 Joined: 21-October 05 Member No.: 13,185 |
the project is now complete, thanks for the advice.
However, my supervisor said sometimes we may not use this kind of relation (many to many). He said we must break down the relation so that there will be no more many to many relation. Does this third table acceptable to make the whole relation to one to many? |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 6th September 2008 - 05:14 PM |