Can i create nested tables on MySql?
for example,access example db, every stude开发者_JAVA百科nt record have a nested table about guardians. http://img101.imageshack.us/img101/9881/53882937.jpg
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’.)
精彩评论