create type Person(name MyString,
social-security integer) [5pt] create type Student
(degree MyString,
department MyString)
under Person
create type Teacher
(salary integer,
department MyString)
under Person
under Student with (department as student-dept),
under Teacher with (department as teacher-dept)
create type TeachingAssistant
To avoid creation of too many subtypes, one approach in the context of database systems is to allow an object to have multiple types without having a most specific type.
Object-relational systems can model such a feature by using inheritance at the level of tables, rather than types, and allowing an entity to exist in more than one table at once.
(name MyString,
social-security integer)
[5pt]
create table students
(degree MyString,
department MyString)
under people
create table teachers
(salary integer,
department MyString)
under people
create table people
create type TeachingAssistantunder Student with (department as student-dept),
under Teacher with (department as student-dept)
Based on the consistency requirements for subtables, if an entity is present in the teaching-assistant table, it is also present in the teachers and in the students table.