Advanced Data Model
Advanced Data Model
1
Entity Supertypes and Subtypes
Entity subtypes
Contains unique characteristics of each entity subtype
2
Specialization Hierarchy
Depicts arrangement of higher-level entity
supertypes (parent entities) and lower-level
entity subtypes (child entities)
Relationships sometimes described in terms of
“IS-A” relationships
Subtype can exist only within context of
supertype and every subtype can have only one
supertype to which it is directly related
Can have many levels of supertype/subtype
relationships
3
Entity Supertypes and Subtypes
(continued)
4
Specialization Hierarchy (continued)
5
Inheritance
Enables entity subtype to inherit attributes and
relationships of supertype
All entity subtypes inherit their primary key
attribute from their supertype
At implementation level, supertype and its
subtype(s) depicted in specialization hierarchy
maintain a 1:1 relationship
6
Inheritance (continued)
7
Subtype Discriminator
8
Disjoint and Overlapping Constraints
Disjoint subtypes
Alsoknown as non-overlapping subtypes
Subtypes that contain unique subset of
supertype entity set
Overlapping subtypes
Subtypes that contain nonunique subsets of
supertype entity set
9
Completeness Constraint
10
Disjoint and Overlapping Constraints
(continued)
11
Sample implementation of generalization hierarchy
12
Natural Keys and Primary Keys
Natural key or natural identifier is a real-
world, generally accepted identifier used to
uniquely identify real-world objects
13
Primary Key Guidelines
14
When to Use Composite
Primary Keys
Useful as identifiers of composite entities,
where each primary key combination is
allowed only once in M:N relationship
Automatically provides benefit of ensuring that
there cannot be duplicate values
Useful as identifiers when an identifying
relationship exists.
15
When to Use Composite Primary Keys
(continued)
16
When To Use Surrogate Primary Keys
Surrogate key- A system assigned primary key,
generally numeric and auto-incremented
Especially helpful when there is:
No natural key
Selected candidate key has embedded semantic
contents
Selected candidate key is too long or cumbersome
If you use surrogate key, ensure that candidate
key of entity in question performs properly
through use of “unique index” and “not null”
constraints
17
Reading recommendation
18