Database design supertypes and subtypescopyright

|
|---|
Objectives
| 3 | |||
|---|---|---|---|
|
Purpose
| CASH | |
|
CHECK |
needs to track payments
from customers. CREDIT CARD• Customers can pay by cash,
by check, or by credit card.
Evaluating Entities
• All payments have some common
| CASH | |
| CHECK |
• And for credit card and check
payments, we may need to know CREDIT CARDwhich CUSTOMER made the
payment, while this is not needed for cash payments.
Evaluating Entities
|
|
|---|---|
| CASH |
|
|
|---|---|
• In this case, the entity is called a
• A subtype:
– Inherits all attributes of the supertype
|
|
|---|---|
|
– Never exists alone


Supertype Example
| • EXAM is a supertype of | |||
|---|---|---|---|
| take | |||
|
|||
|
|||
| • The subtypes have | |||
|
BONUS |
|
|
| • These common | QUESTION | ||
|
|


| • The same applies to | STUDENT | ||
|---|---|---|---|
| take | |||
|
|||
|
|||
| • Subtypes inherit all | |||
| BONUS |
|
||
|
|||
EXAM SUPERTYPE
• This idea leads to the two subtype rules:
– Exhaustive: Every instance of the supertype is also an instance of one of the subtypes. All subtypes are listed without
omission.– Mutually Exclusive: Each instance of a supertype is an instance of only one possible subtype.
| 12 | |||
|---|---|---|---|
Always More Than One Subtype
|
|
WALLCOVERING SUPERTYPE
|
PAINT | ||
|---|---|---|---|
|
WALLPAPER | ||
| FABRIC | |||
| • When a need exists within the | OTHER | ||
|
|||
| 14 | |||
(exhaustive)
|
OTHER |
|---|
| ANIMAL | ||
|---|---|---|
| VERTEBRATE | ||
| BIRD | ||
|
||
| MAMMAL |
|
|
Terminology
Key terms used in this lesson included:
| 17 | |||
|---|---|---|---|
|
Summary




