0

これが私が解決しようとしている問題です:

Entity A : a_id
Entity B : b_id
One A can use Many B's. However, not all Bs are used by all As.

これが私が考えることができる最良の例です:

One teacher has many students.
Some students are taught by more than one teacher.

1 人の教師が教えている生徒を追加/削除できるが、既にその生徒を教えている教師には影響しないような関係とは何ですか?

4

2 に答える 2

2

この 2 つを関連付ける StudentTeacher エンティティが必要です。a_id 列と b_id 列があります。

于 2012-06-10T02:36:10.917 に答える
2

この2つのテーブル間のマッピングと呼ばれる3番目のテーブルが必要です.このテーブルを作成します:

Table Student_Teacher_Mapping

   Id (Int)
   TeacherId(Int)  // foreign key for teacher table  
   StudentId(Int)  // foreign key for student table

これがあなたが望むものだと思います。

于 2012-06-10T02:42:39.480 に答える