Jimmie,
> Say I have a tbl_person. tbl_teacher and tbl_student both inherit
> from
> tbl_person and each have their own extended attributes. Is it
> possible for
> a person in tbl_person to be both a teacher at the school, and also a
> student (say night school or something). Also, the student may be a
> part-time employee, like a graduate student. If it is possible, what
> would
> an insert look like. Given the possibility that someone can exist in
> both
> tbl_teacher and tbl_student, what happens if you delete their student
> record. I'm guessing that it should leave the other records in tact.
IMHO, inheritance is *not* the way to do this. What you want
relationally is three tables:
tbl_people
tbl_student_attributes
tbl_teacher_attributes
Then you can define two views:
vw_students
tbl_people JOIN tbl_student_attributes
vw_teachers
tbl_people JOIN tbl_teacher_attributes
This way, if a student's teaching assignment ends, you can delete her
teacher_attributes while keeping her in the system as a studnet;
contrawise, if she quits the institution, you can delete her record in
tbl_people and remove her from the system.
Further, by defining the triggers to make the views updatable, you can
treat them as if they were tables ... e.g. "UPDATE vw_students WHERE
..." This allows you to maintain perfect relational integrity while
dealing with the fact that a few individuals are both students and
teachers.
Fabian Pascal has a whole chapter about how properly designed relational
structures make inheritance unnecessary or even hazardous ... see
"Practical Issues in Database Design."
-Josh Berkus
P.S. hey, Tom, do you think that simple views can be made automatically
updatable by default someday? version 8.0?
______AGLIO DATABASE SOLUTIONS___________________________ Josh Berkus Complete
informationtechnology josh@agliodbs.com and data management solutions (415) 565-7293 for law firms, small
businesses fax 621-2533 and non-profit organizations. San Francisco