Databases Reference
In-Depth Information
Student
entity
Student
StudentNum
LastName
FirstName
One line
indicates incomplete
categories
StudentDorm
category (entity
subtype)
212
SeniorStudent
category (entity
subtype)
StudentDorm
StudentNum (FK)
DormNum (FK)
SeniorStudent
StudentNum (FK)
ThesisTitle
ThesisArea
FIGURE 6-32
Two entity subtypes—incomplete categories
By contrast, Figure 6-33 represents a slightly different situation. There are two categories: students who
live in dorms (StudentDorm) and students who do not (StudentNonDorm) live in dorms. For students who
live in dorms, the attribute of interest is DormNum. For students who do not live in dorms, the attributes of
interest are the ones that give the students' local addresses (LocalStreet, LocalCity, LocalState, and
LocalZip). The difference between this example and the one shown in Figure 6-32 is that every student must
be in one of these two categories. These are called complete categories and are represented by two lines below
the category symbol.
Student
entity
Student
StudentNum
LastName
FirstName
Two lines
indicate complete
ca t egories (every student
is in one of the
categories)
StudentDorm
category (entity
subtype)
StudentDorm
StudentNum (FK)
DormNum (FK)
StudentNonDorm
StudentNum (FK)
LocalStreet
LocalCity
LocalState
LocalZip
SeniorStudent
category (entity
subtype)
FIGURE 6-33
Two entity subtypes—complete categories
You should group columns that can be null by function. If a given subset of the entity in question can have
nulls in a certain collection of columns, you should note this fact. When available, you should strongly con-
sider splitting columns that can have nulls into a separate table (an entity subtype). If you create an entity sub-
type, you should give the entity subtype a name that suggests the related entity type, such as SeniorStudent
for students who are seniors. In addition, you should carefully document the meaning of the entity sub-
type, especially the conditions that will cause an occurrence of the entity type also to be an occurrence of the
entity subtype. If you do not create such an entity subtype, you must at least document precisely when the col-
umns might take on null as a value.
 
 
Search WWH ::




Custom Search