Modul 4 - Database Modelling and Design
Modul 4 - Database Modelling and Design
Design
CONCEPTUAL AND LOGICAL DESIGN
2
ER diagram of Branch user views of
DreamHome
Entity types
¡Group of objects with same properties, identified by
enterprise as having an independent existence:
÷Physical: Staff, Property, Customer, Part, Supplier, Product
÷Conceptual: Sale, Course, Inspection.
Relationship types
¡Set of meaningful associations among entity types.
¡Degree of a Relationship
÷Number of participating entities in relationship: Unary, Binary,
Ternary, Quaternary
Attributes
¡Property of an entity or a relationship type.
Candidate Key
◦Minimal set of attributes that uniquely identifies each
occurrence of an entity type.
Primary Key
◦Candidate key selected to uniquely identify each
occurrence of an entity type.
Composite Key
◦A candidate key that consists of two or more attributes.
10
© Pearson Education Limited 2010
ER diagram of Staff and Branch entities and
their attributes
11
© Pearson Education Limited 2010
Entity Type
Superclass
◦ Anentity type that includes one or more distinct
subgroupings of its occurrences.
Subclass
◦ A distinctsubgrouping of occurrences of an
entity type.
Superclass/subclass relationship is
one-to-one (1:1).
Superclass may contain overlapping
or distinct subclasses.
Not all members of a superclass need
be a member of a subclass.
Attribute Inheritance
◦ An entity in a subclass represents same ‘real
world’ object as in superclass, and may possess
subclass-specific attributes, as well as those
associated with the superclass.
Specialization
◦ Processof maximizing differences between
members of an entity by identifying their
distinguishing characteristics.
Generalization
◦ Process of minimizing differences between
entities by identifying their common
characteristics.
Participation constraint
◦Determines whether every member in superclass
must participate as a member of a subclass.
◦May be mandatory or optional.
Disjoint constraint
◦Describes relationship between members of the subclasses
and indicates whether member of a superclass can be a
member of one, or more than one, subclass.
◦May be disjoint or nondisjoint.
36
Mapping from E-R Diagram
to Relations
(1) Strong entity types
◦ For each strong entity in the data model, create a relation that
includes all the simple attributes of that entity. For composite
attributes, include only the constituent simple attributes.
(2) Weak entity types
◦ For each weak entity in the data model, create a relation that
includes all the simple attributes of that entity. The primary key
of a weak entity is partially or fully derived from each owner
entity and so the identification of the primary key of a weak
entity cannot be made until after all the relationships with the
owner entities have been mapped.
Other options:
45
Conceptual data model for Staff view showing all
attributes
53
Domain
Domains can be defined in different ways.
§ Data Type: Domains that specify the standard types of data one can have in an
attribute assigned to that domain. For example, Integer, Character(30), and Date
are all data type domains.
§ Data Format: Domains that use patterns including templates and masks, such as
are found in postal codes and phone numbers, and character limitations
(alphanumeric only, alphanumeric with certain special characters allowed, etc.) to
define valid values.
§ List: Domains that contain a finite set of values. These are familiar to many people
from functionality like dropdown lists. For example, the list domain for
OrderStatusCode can restrict values to only{Open, Shipped, Closed, Returned}.
§ Range: Domains that allow all values of the same data type that are between one
or more minimum and/or maximum values. Some ranges can be open-ended. For
example, OrderDeliveryDate must be between OrderDate and three months in the
future.
§ Rule-based: Domains defined by the rules that values must comply with in order
to be valid. These include rules comparing values to calculated values or other
attribute values in a relation or set. For example, ItemPrice must be greater than
ItemCost.
54