0% found this document useful (0 votes)
10 views43 pages

AD Chap1 Part I

The document provides an overview of the Entity-Relationship (E-R) model, which is utilized for constructing conceptual data models through entities, relationships, and attributes. It explains various components such as strong and weak entity types, attributes (including composite and multivalued), and different types of relationships (unary, binary, ternary) along with their cardinality. Additionally, it outlines the design steps for E-R modeling and includes a practical example related to Pine Valley Furniture Company.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views43 pages

AD Chap1 Part I

The document provides an overview of the Entity-Relationship (E-R) model, which is utilized for constructing conceptual data models through entities, relationships, and attributes. It explains various components such as strong and weak entity types, attributes (including composite and multivalued), and different types of relationships (unary, binary, ternary) along with their cardinality. Additionally, it outlines the design steps for E-R modeling and includes a practical example related to Pine Valley Furniture Company.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 43

Chapter 1 – Part 1

THE ENTITY RELATIONSHIP


MODEL

Course: Advanced Databases

1
Introduction

E-R model is popular, due to following factors:


 ease of use
 CASE tool support
 Entities and relationships are natural modeling
concepts.
E-R model is used to construct a conceptual data
model.

2
THE E-R MODEL
 The E-R model is expressed in terms of
 entities
 relationships among those entities, and
 the attributes of both the entities and their
relationships.
 The E-R model is expressed as an entity-
relationship diagram (E-R diagram).
 E-R Diagram: A graphical representation of
an entity-relationship model.

3
An Example

4
Basic E-R Notations

5
Entities
Entity: A person, place, object, event, or concept in the user
environment about which the organization wishes to maintain
data.
Example: CUSTOMER,
STUDENT, PATIENT
CITY, COUNTRY
SALE, REGISTRATION
COURSE, ACCOUNT
Entity Type versus Entity Instance

Entity type: A collection of entities that share common


properties or characteristics

Entity Instance: A single occurrence of an entity type


6
Strong versus weak entity types
Strong entity type: An entity that exists independently of other
entity types.

Weak entity type: An entity type whose existence depends on


some other entity type.

7
Attributes
Each entity type has a set of attributes associated with it.
Attribute: A property or characteristic of an entity type that is
of interest to the organization.

STUDENT: Student_ID, Student_Name, Address, Major.

AUTOMOBILE: Vehicle_ID, Color, Weight, Horsepower.

Composite attribute: An attribute that can be that can be


broken down into component parts.

Simple (atomic) attribute: An attribute that can be that cannot


be broken down into component parts.
8
Composite Attribute

9
Multivalued Attribute
Multivalued attribute: An attribute that may take on more
than one value for a given entity instance.

Derived attribute: An attribute whose values can be


calculated from related attribute values.
10
Identifier
Identifier: An attribute (or a combination of attributes) that
uniquely identifies individual instances of an entity type.

11
Composite identifier
Composite identifier: An identifier that consists of a composite
attribute.

12
RELATIONSHIPS
Relationship represents an association between (or among)
entity types.
Relationship Type: A meaningful association between (or
among) entity types.
Relationship instance: An association between (or among)
entity instances, where each relationship instance includes
exactly one entity from each participating entity type.
Register
Student_Name Course_Name Date_Completed Grade
Chen C++ 06/1998 A
Kim Java 10/1998 B+
Kim Basic 06/1998 C+ 13
Attributes on Relationship

Attributes may be associated with a many-many


(or one-to-one) relationships

14
Degree of a Relationship

-Unary Relationship
-Binary Relationship
-Ternary Relationship

15
Cardinality of Relationship
One – to – One
Each entity in the relationship will have exactly one related
entity

One – to – Many
An entity on one side of the relationship can have many
related entities, but an entity on the other side will have a
maximum of one related entity

Many – to – Many
Entities on both sides of the relationship can have many
related entities on the other side

16
Cardinality Constraints

Cardinality Constraints - the number of instances of


one entity that can or must be associated with each
instance of another entity.

Minimum Cardinality
If zero, then optional
If one or more, then mandatory

Maximum Cardinality
The maximum number

17
Cardinality

18
Unary Relationship

Unary relationship: a relationship between the


instances of a single entity type

19
Binary Relationship

20
Ternary Relationship

21
Maximum Cardinality

Mandatory Mininum Cardinality

22
A Unary relationship with an attribute

23
Optional Cardinality in unary relationship

24
Modeling Time-dependent data

Each value of the attribute Price is time-stamped with its


effective date.
25
Associative Entities
There are some reasons that the designers want to represent
a relationship as an entity type. That means a relationship
is abstracted into a new entity type.

Associative entity: An entity type that associates the


instances of one or more entity types and contains
attributes that are peculiar to the relationship between
those entity instances.

26
Ternary relationship as associative
entity

27
Conditions of associative
entity
Four conditions:
 The relatioship must be a “many-to-many”
relationship.
 The resulting associative entity has independent
meaning to end users, and can be identified with a
single-attribute identifier.
 The associative entity has one or more attributes,
in addition to the identifier.
 The associative entity participates in one or more
relationships independent of the entities related in
the associated relationship.

28
Cardinality of terniary relationships
Case 1:1:1
ENGINEER

uses

CASEBOOK PROJECT

All engineer will use one casebook for given project. Different engineers
use different casebook for the same project. No engineer will use the
same casebook for different projects.

29
Case 1:1:1

Funtional dependences:

EMP-NO, PROJ-NO  BOOK-NO


BOOK-NO, PROJ-NO  EMP-NO
EMP-NO, BOOK-NO  PROJ-NO

30
Case 2: 1:1:N
Students work on projects under instructions of teachers.
No teacher can instruct any given student on more one
project. No student can work on any given project under the
instruction of more than one teacher.

FDs:
STUD-NO, EMP-NO  PROJ-NO
STUD-NO, PROJ-NO  EMP-NO

31
STUDENT

supervises

TEACHER PROJECT

32
Case 3: 1:M:N
Employees are assigned to one or more projects, but can only be assigned to
at most one project at a given location.
FDs:
EMP-NO, LOC-NAME  PROJ-NO

EMPLOYEE

assigns

PROJECT LOCATION

33
Case 4: N:M:L
PART

supplies

VENDOR WAREHOUSE

FDs: PART-NO, VENDOR-NO, WAREHOUSE-NO 


other attributes.

34
Multiple relationships

Examples of multiple relationships – entities can be


related to one another in more than one way.

35
Design steps of E-R Modeling

Step 1. Identify entity types

Step 2. Identify relationship types

Step 3. Identify and associate attributes with entity


or relationship types.

Step 4. Determine identifiers for entity types


Step 5. Identify Supertype/Subtype constructs
(optional)
Step 6. Draw E-R diagram
36
Some guidelines
-Ifthere is descriptive information about one object,
the object should be clasified as an entity.

-Attachattributes to entities that they they describe


most directly.

-Redundant relationship should be eliminated.

-Ternary relationships must be defined carefully.

37
E-R Diagram of
Sample Database

38
Reference

 Jeffrey A.Hoffer, V.Ramesh. Heikki Topi,


Modern database management -11th
Edition, Pearson, 2013.

39
Pine Valley Furniture Company
 The company sells a number of different furniture products. These
products are grouped into several product lines. The identifier for a
product is Product_ID, whereas the identifier for a product line is
Product_Line_ID. We identify the following additional attributes for
product: Product_Description, Product_Finish, and Standard_Price.
Another attribute for product line is Product_Line_Name. A product
line may group any number of products but must group at least one
product. Each product must belong to exactly one product line.
 Customers submit orders for products. The identifier for an order is
Order_ID, and another attribute is Order_Date. A customer may
submit any number of orders, but need not submit any orders. Each
order is submitted by exactly one customer. The identifier for a
customer is Customer_ID. Other attributes include
Customer_Name, Customer_Address, and Postal_Code.
 A given customer order must request at least one product and only
one product per order line item. Any product sold by Pine Valley
Furniture may not appear on any order line item or may appear on
one or more order line items. An attribute associated with each
order line is Ordered_Quantity

40
 Pine Valley Furniture has established sales territories for its
customers. Each customer may do business in any number of these
sales territories or may not do business in any territory. A sales
territory has one-to-many customers. The identifier for a sale
territory is Territory_ID and an attribute of a Territory_Name.
 Pine Valley Furniture has several salespersons. The identifier for a
salesperson is Salesperson_ID. Other attributes include
Salesperson_Name, Salesperson_Telephone, and
Salesperson_Fax. A salesperson serves exactly one sales territory.
Each sales territory is served by one or more salespersons.
 Each product is assembled from a specified quantity of one or more
raw materials. The identifier for the raw material entity is
Material_ID. Other attributes include Unit_of_Measure,
Material_Name and Standard_Cost. Each raw material is
assembled into one or more products, using a specified quantity of
the raw material for each product.
 Raw materials are supplied by vendors. The identifier for a vendor
is Vendor_ID. Other attributes include Vendor_Name and
Vendor_Address. Each raw material can be supplied by one or
more vendors. A vendor may supply any number of raw materials or
may not supply any raw materials to Pine Valley Furniture. An
attribute of the relationship between vendor and raw material is
Supply_Unit_Price
41
 Pine Valley Furniture has established a number of work
centers. The identifier for a work center is Work_Center_ID.
Another attribute is Work_Center_Location. Each product is
produced in one or more work centers. A wok center may be
used to produce any number of products or may not be used
to produce any product.
 The company has over 100 employees. The identifier for
employee is Employee_ID. Other attributes include
Employee_Name, Employee_Address and Skill. An employee
may have more than one skill. Each employee may work in
one or more work centers. A work center must have at least
one employee working in that center, but may have any
number of employees.
 Each employee has exactly one supervisor except managers,
who have no supervisor. An employee who is a supervisor
may supervise any number of employees, but not all
employees are supervisors.

42
entity type, entity, relationship, attribute, identifier, weak
entity, entity instance, identifying relationship, composite
attribute, atomic attribute, derived attribute, multivalue
attribute, time-dependent-data, one-to-one relationship,
one-to-many relationship, many-to-many relationship,
associative entity, cardinality of relationship, unary
relationship, binary relationship, ternary relationship,
cardinality constraints, ER model, ER diagram, functional
dependencies, business rules.

43

You might also like