Database
Database
Some of the reason entity supertypes are used in database design are:
A specialization hierarchy in databases is a structure that arranges different types of data into
a family tree-like format. It's used to show how general categories, called supertypes (like
"employee"), relate to more specific ones, called subtypes (like "pilot" or "mechanic"). For
instance, all pilots, mechanics, and accountants are considered types of employees. Each
subtype inherits characteristics from its supertype. In this hierarchy, a subtype can only
belong to one supertype, but a supertype can have multiple subtypes. This arrangement keeps
data organized and understandable, allowing new subtypes to be added easily while
maintaining consistency across the database.
A subtype discriminator is the attribute in the supertype entity which is like a label that
helps identify which specific subtype an entity belongs to within a supertype. It's an
attribute in the supertype that holds information pointing to the subtype it corresponds to.
For example, in a Vehicle supertype, the subtype discriminator might be Type, and it
could have values like Car, Truck, or Motorcycle to indicate the specific type of vehicle.
So, when we look at a vehicle's record, the 'Type' attribute tells you whether it's a car,
truck, or motorcycle. This helps organize data and makes it easier to understand and
manage different types of entities within the database.
An overlapping subtype is a subtype where the entities within it can also belong to other
subtypes of the same supertype. It means that one entity instance of the supertype can fit into
multiple subtypes simultaneously.
For example, Let's consider a database where Vehicle is the supertype. In this case, Car and
'Truck' might be subtypes. However, some vehicles, like pickup trucks, can be both cars and
trucks. Pickup trucks share characteristics of both cars and trucks. So, Car and Truck are
overlapping subtypes of the supertype 'Vehicle'. This overlap occurs because certain vehicles
possess attributes and functionalities that belong to both car and truck categories.
A disjoint subtype is a subtype where each entity instance of the supertype can belong to only one of the
subtypes; they don't overlap. In simpler terms, it means that each entity fits neatly into one subtype
category without being part of any other subtype. For example, consider a database where Vehicle is the
supertype. In this case, Car and Motorcycle can be subtypes. Each vehicle in the database must fit into one
of these categories exclusively.
For example, a specific vehicle instance, such as a sedan, can only be categorized as a 'Car' and not as a
'Motorcycle' at the same time. Similarly, a motorcycle instance cannot also be classified as a car. So, 'Car'
and 'Motorcycle' are disjoint subtypes of the supertype 'Vehicle'. This ensures that each vehicle in the
database is clearly categorized into one specific subtype without any overlap.
Partial Completeness: In a partially complete relationship, not every instance of the supertype
is required to be a member of a subtype. This means that there can be instances of the
supertype that do not fit into any of the defined subtypes. For example, in a 'Shape' supertype
with subtypes 'Circle' and 'Square', there might be other shapes that don't fit neatly into these
categories, such as a triangle or a polygon. These shapes would be considered instances of
the supertype but not members of any subtype.
Total Completeness: On the other hand, total completeness dictates that every instance of the
supertype must belong to at least one of the defined subtypes. In other words, there are no
instances of the supertype that are not accounted for in the subtype categories. Using the
same 'Shape' example, if the relationship is totally complete, every shape in the database
must be either a 'Circle' or a 'Square' or belong to another defined subtype. There are no
shapes left in the supertype that are not part of a subtype.
To sum up the partial completeness allows for flexibility, permitting instances of the
supertype to exist outside of defined subtypes, while total completeness requires that every
instance of the supertype must belong to a defined subtype.
7. Given the following business scenario, create a Crow’s Foot ERD using a
specialization hierarchy if appropriate.