I have a list of tables i.e. student, teacher, staff, deptt. etc and each of these tables have remarks specific to them. Now one table can have one or many remarks that shows its a one to many relation from any table to remarks table. I don't know whats the best way to relate remarks table to each of these. If put foreign key from remarks table to each of these tables, it will be like 7-8 fields depending on no. of tables. Secondly if I add foreing key from each of these tables to remarks table, it will be like repeating whole row just for the second remarks foreing key? Any suggestion on how to achive efficeint solution?

If you don't need the relationship, I would suggest moving the remarks back up the owning table.

If you do need the relationship, with the foreign key concept create a reference table.

student
STUDENT_ID
STUDENT_NAME

students2remarks
STUDENT_ID
REMARK_ID

remarks
REMARK_ID
REMARK

the table will can be used as a bridge in between the two

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.