Hi Guys,
I am new to Database and Postgresql.
I created an ERD diagram to store information on students, parents, teachers and schools, part of my design instead of having address for each entity I create a new entity called address and contains a composite primary key from (studentID, partentID, techerID, schoolID), streetName, suburb, postcode and state:
• Student can have one or more Address
• Parent can have one or more Address
• Teacher can have one or more Address
• School can have one or more Address
I used this method avoid the redundancy for address, and I created the tables for each (student, parent, teacher, school, address) then I populated the tables with values using “INSERT VALUE” statement, but I have problem now when I am inserting values for address because I have enter the (studentID, partentID, techerID, schoolID) for each row and the issue is say for instance a studentID and prentID may have the address but for the teacher and school may have different address.
I designed the database to have a separate entity for address and with composite primary key from (studentID, partentID, techerID, schoolID), but after populating the values for the address table how do I know which address belongs to whom, because I have to have 4 IDs from the (studentID, partentID, techerID, schoolID), I am really confuse.
Thank you in advance.