views:

65

answers:

1

I am planning for an application of time-table generation. I wanted the data such as standardname, teachername, standard wise subjects and also relate the corresponding teacher with the subject and standard.

I had think like,

StandardMaster(stdid,stdname)  
TeacherMaster(teacherid,teachername)  
SubjectMaster(subid,subname,stdid)

I want the table with relation of teacher subject and standard tables.What more I need? Any corrections needed in these three tables?

+1  A: 

hm. looks like you also need relations between the teacher and the subject also - the Master can be left off safely in the names.

**standard**
standard_id
name

**teacher**
teacher_id
name

**subject**
subject_id
name

**subject_standard**
subject_id
standard_id
begin_date
end_date

**subject_teacher**
subject_id
teacher_id
begin_date
end_date
Randy
Can you tell me the primary keys. Also wanted to know the use of begin_date and end_date in subject_standard and subject_teacer
Himadri
@Randy I did not understand the purpose of rows begin_date and end_date
Himadri
Usually, the begin date and end date can serve to capture all history for the relationshio. In this case, you will know something like TeacherA taught subjectA last year, but no longer teaches it this year. etc.
Randy
as for primary keys, the id values should normally be numeric, unique, not null, and serve as the PK for each table. The joining tables do not have any good uniqueness to worry about - I assume you will allow more than one teacher to teach the same subject at one time.
Randy
@Randy I don't need last year information. Just current year info.
Himadri
ok - those are not mandatory - i just find that pattern useful in general.
Randy
@Randy I can also merge subject_standard_teacher(subjectid,standardid,teacherid) and the primary key for this table must be combination of all three field. right?? Is there any other good option. Because, this is not normalized table.
Himadri