ghassan_aljabiri
Member
- Joined
- Mar 25, 2009
- Messages
- 23
- Programming Experience
- Beginner
hello
my database contains two tables (subjects,lessons)
every subject consists of many lessons
now a relation of many to one should be constructed between lessons and subjects
i have two options and i want to know which is better and why?
first
construct a third table with the name lessonsInSubjects with two foriegn keys
second
add a field to the lessonstable as a foreign key
so which is better?
my database contains two tables (subjects,lessons)
every subject consists of many lessons
VB.NET:
[B]subjects table[/B]
--------------
subjectid bigint (pk)
subjectname text
[B]lessons table[/B]
--------------
lessonid bigint (pk)
lessonname text
now a relation of many to one should be constructed between lessons and subjects
i have two options and i want to know which is better and why?
first
construct a third table with the name lessonsInSubjects with two foriegn keys
VB.NET:
subjects table
--------------
subjectid bigint (fk)
lessonid bigint (fk)
second
add a field to the lessonstable as a foreign key
VB.NET:
[B]subjects table[/B]--------------
subjectid bigint (pk)
subjectname text
[B]lessons table[/B]--------------
lessonid bigint (pk)
belongsto bigint (fk)
lessonname text
so which is better?