Chap3-Conceptual Data Modeling Using Entities and Relationships
Chap3-Conceptual Data Modeling Using Entities and Relationships
NULL values
Complex attributes
Composite versus Simple (Atomic) Attributes
Composite Attributes
• can be divided into smaller subparts, which represent more
basic attributes with independent meanings.
• For example, the Address attribute of the EMPLOYEE entity
can be subdivided into Street_address, City, State, and Zip
• can form a hierarchy
• For example, Street_address can be further subdivided into
three simple component attributes: Number, Street, and
Apartment_number
Figure: A hierarchy of composite attributes.
Single-Valued
• attributes that have a single value for a particular entity
• For example: age attribute of a person
Multivalued
• attributes that can have a set of values
• For example: college degree of a person
Stored versus Derived Attributes
Stored
• An attribute, which cannot be derived from other attribute
• For example, BirthDate of an employee
Derived
• Attributes derived from other stored attribute
• For example age from Date of Birth and Today’s date
individual attributes
Entity Types
a collection (or set) of entities that have the same attributes
Each entity type in the database is described by its name and
attributes
Entity set
collection of all entities of a particular entity type in the
database at any point in time
the entity set is usually referred to using the same name as
the entity type
Figure: Two entity types, EMPLOYEE and COMPANY, and some
member entities of each.
An entity type describes the schema or intension for a set of
entities that share the same structure.
The collection of entities of a particular entity type is
grouped into an entity set, which is also called the extension of
the entity type.
An entity type is represented in ER diagrams a rectangular box
enclosing the entity type name
Attribute names are enclosed in ovals and are attached to their
entity type by straight lines
Composite attributes are attached to their component
attributes by straight lines.
Multivalued attributes are displayed in double ovals
Key Attributes of an Entity Type
An entity type usually has one or more attributes whose values
are distinct for each individual entity in the entity set. Such an
attribute is called a key attribute, and its values can be used to
identify each entity uniquely
For example, the Name attribute is a key of the COMPANY
entity because no two companies are allowed to have the
same name.
In ER diagrammatic notation, each key attribute has its name
underlined inside the oval
Some entity types have more than one key attribute.
For example, each of the Vehicle_id and Registration attributes
of the entity type CAR is a key in its own right
Example:
The CAR entity type with two key attributes, Registration and
Vehicle_id.
individual entity
For ex: if the range of ages allowed for employees is between
18 and 70, we can specify the value set of the Age attribute of
Relationship
An association among two or more entities
Each relationship has a name
Each of the entity types E1, E2, ..., En is said to participate in the
relationship type R
1. Unary
ex:
- Binary
- Ternary
Role Names and Recursive Relationships
The role name signifies the role that a participating entity from
the entity type plays in each relationship instance, and helps to
explain what the relationship means.
For example, in the WORKS_FOR relationship type, EMPLOYEE
plays the role of employee or worker and DEPARTMENT plays
the role of department or employer.
Role names are not technically necessary in relationship types
where all the participating entity types are distinct, since each
participating entity type name can be used as the role name.
However, in some cases the same entity type participates more
than once in a relationship type in different roles.
In such cases the role name becomes essential for distinguishing
the meaning of the role that each participating entity plays. Such
relationship types are called recursive relationships.
Example of recursive relationships : SUPERVISION relationship
type
The SUPERVISION relationship type relates an employee to a
relationship.
.
Weak Entity Types
Entity types that do not have key attributes of their own are
called weak entity types
Entities belonging to a weak entity type are identified by being
related to specific entities from another entity type in
combination with one of their attribute values
We call this other entity type the identifying or owner entity
type
we call the relationship type that relates a weak entity type to
its owner the identifying relationship of the weak entity type
Consider the entity type DEPENDENT, related to EMPLOYEE,
which is used to keep track of the dependents of each
employee via a 1:N relationship
In our example, the attributes of DEPENDENT are
Name,Birth_date, gender, and Relationship (to the employee).
Two dependents of two distinct employees may, by chance,
have the same values for Name, Birth_date, gender, and
Relationship, but they are still distinct entities.
They are identified as distinct entities only after determining the
particular employee entity to which each dependent is related.
Each employee entity is said to own the dependent entities that
are related to it.
A weak entity type always has a total participation constraint
(existence dependency) with respect to its identifying relationship
because a weak entity cannot be identified without an owner entity.
A weak entity type normally has a partial key, which is the attribute
that can uniquely identify weak entities that are related to the same
owner entity.
In our example, if we assume that no two dependents of the same
employee ever have the same first name, the attribute Name of
DEPENDENT is the partial key.
In ER diagrams, both a weak entity type and its identifying
relationship are distinguished by surrounding their boxes and
diamonds with double lines.
The partial key attribute is underlined with a dashed or dotted line.
Topic for Self Learning
i) Each Movie is identifies by its title and year of release, it has length
iii) Actors are identified by Name and Date of Birth, they can act in
Director can direct one or more movie and each movie can be
etc.
10. Draw a ER-Diagram of movie database. Assume your own
entities(minimum 4) attributes and relationships.
11. Draw an ER diagram for BANK database schema with atleast
five entity types. Also specify primary key and structural
constraints
College database