DB 2
DB 2
Introduction
Independent of :
Entities
Relationships among entities
Attributes of both the entities and their
relationships
Entity
An entity is a
person, place, thing,
or event which an
organization wishes
to maintain data
about
Examples:
Student
Subject
Instructor
An entity is
represented by a
rectangle
STUDENT
SUBJECT
Entity type
Entity instance
Attributes
An attribute is a
characteristic of an
entity
Sample attributes
of the STUDENT
entity
Name
ID Number
Address
Birthday
An attribute is
represented by an
ellipse
Name
ID_Num
STUDENT
Address
Birthday
7
Value of an Attribute
Attribute: Name
Values:
Fox Mulder
Dana Scully
Multivalued Attributes
Attributes having
more than one
value for each
entity instance
Example:
Hobby - a student
may have more
than one hobbies
A multivalued
attribute is
represented by a
double ellipse
Hobby
STUDENT
10
Composite Attributes
An attribute
broken into
component parts
11
12
Derived Attribute
Derived
from date employed and
current date
13
Relationship
A relationship is a
natural association
between the
instances of one or
more entities
Example:
enrolls - a student
enrolls in a subject
A relationship is
represented by a
diamond-shaped
symbol
STUDENT
enrolls
SUBJECT
Relationships may
also have attributes
16
Degree of a Relationship
Unary relationship
Binary relationship
Ternary relationship
17
Unary Relationship
A recursive
relationship within
a single entity
Exists within an
entity to link related
instances of that
entity together
PERSON
is
married
to
18
Binary Relationship
STUDENT
enrolls
SUBJECT
19
Ternary Relationship
VENDOR
ships
WAREHOUSE
20
Optional Relationship
Mandatory Relationship
21
Types of Relationship
One-to-one relationship
One-to-many relationship
Many-to-many relationship
22
Cardinality
Examples of Cardinality
24
25
26
Optional cardinality
Mandatory cardinality
If minimum cardinality is 0
If minimum cardinality is 1
Mandatory 1
cardinality
27
Mandatory 1-Many
cardinality
Optional 0 or 1
cardinality
Optional 0-Many
cardinality
28
Here, maximum
cardinality
constraint is 4
29
Multiple Relationships
30
Strong entities
Weak entity
Identifying relationship
Strong entity
Identifying relationship
Weak entity
32
Also known as
composite entity
A many-to-many
relationship modeled as
an entity type
It is a relationship (but
would want to maintain
data about)
It is an entity in disguise
Has independent
meaning to end-users
and preferably
identifiable by a single
attribute
A gerund is
represented by a
diamond within a
rectangle
SHIPMENT
33
Name
EMP
Emp #
completes
Name
EMP
Date Completed
Date Completed
CERTIFICATE
Course ID
Title
COURSE
Course ID
Title
COURSE
Certificate #
34
35
36
Basic Notation
38
40
Generalization
Specialization
Completeness Constraints
42
43
A vehicle could be a
car, a truck, or neither
44
Disjointness Constraints
Disjointness Constraints
46
Overlap Constraints
A part may be
both purchased
and manufactured
47
Constraints in Supertype/Subtype
Discriminators
A simple attribute
with different
possible values
indicating the subtype
49
A composite attribute
with sub-attributes
indicating yes or
no to determine
whether it is of each
subtype
50
Supertype/Subtype Hierarchy
51
Entity
Clusters
52
Inappropriate Diagrams
System user
System output
contain a user of
the system
contain an output
of the database
system (e.g. a
report)
be confused with
a user view
53