Entity Relationship Diagram
Hi guys i am currently working on a erd for a attendance system. I have 6 tables (Class,Programme,Faculty, User(Lecturer/Admin), Attendance and Student. I have a primary key of p_code in "Programme" table and i was wondering if the "p_code" can be a foreign key in Student table?. Because from what i have learnt previously was that any "people" table cant have any foreign key is it true?
You have to understand the rationale behind having a foreign key. What is the relationship between Student and Programme? Can one student participate in many programmes? Can a programme be participated by may students? If both of these cases are true, then you have a many-to-many relationship. Placing p_code as foreign key in Student would result in redundancy. You can resolve this by having a bridge entity to store the records of student and their programmes, e.g. Student_Programme, with attributes: sp_code (primary key) s_code (foreign key, Student) p_code (foreign key, Programme)
The relationship between my Student and Programme table is one student can participate in only 1 Programme but 1 Programme can have many students.