tags:

views:

36

answers:

1

for example,access example db, every student record have a nested table about guardians. http://img101.imageshack.us/img101/9881/53882937.jpg

+5  A: 

No. Something like that is almost always done as a single mapping table for all students, with a foreign key column pointing to the student table to specify which student a particular row relates to.

You then just filter the table to match a given student, and present that list without a student column, in the UI. It looks like a separate table to the user, but that's not actually how it's stored.

(If you did create a separate guardians table for each student, you'd make it impossible to do queries like ‘find students for a particular guardian’.)

bobince
Alternatively, if e.g. you wanted to track the guardian records for siblings together, you can use a join table: i.e. have a student table, a guardian table (without the student FKR) and then a 'student-guardian' table with just pairs of student ID and guardian ID, each FKRed to the appropriate table. You then have a many-to-many mapping between students and guardians. (This may be what the 'students and guardians' table is in your screenshot.) Although in this case you might want to move the 'relationship' value into the join table.
Rup