Documente Academic
Documente Profesional
Documente Cultură
Database Design
Methodology
Chapter 3 Basic Concepts of
Entity-Relationship Model
Learning Goals
Table of Contents
Entity-Relationship Model
Entity
Entity Set
Attribute
Relationship
3
Scenario of an Online
Bookstore
Consider the following scenario
Scenario of an Online
Bookstore
Problem:
Scenario of an Online
Bookstore
Database Design
Design the
Database
User_1s
requirements
User_2s
requirements
User_ns
requirements
Logical
database
structure
All users
requirements
Database
Database Design
2.
3.
Database Design
All users
requirements
Conceptual
Database Design
Logical
Database Design
Database
10
Database Design
We will study the conceptual design in this and the next chapter.
Database Design
12
Database Design
View Level
Conceptual
Level
Physical Level
Conceptual Design
Logical Design
Physical Design
13
Database Design
14
15
16
Entity-Relationship Model
Entity-Relationship Model
Entity
Entity Set
Attribute
Relationship
18
Entity-Relationship Model
Entity
Entities may be physical (e.g. a student) or nonphysical (e.g. an event in sport day, an exam).
Entity-Relationship Model
Im an entity
Exam
Im also
an
entity
Im an entity
Im an entity
Im an entity
Im an entity
Im an entity
20
Entity-Relationship Model
Attribute
Entity-Relationship Model
Attributes of a student
stud_id
name
dob
sex
Entity: a student
22
Entity-Relationship Model
Attributes of a book
title
author
ISBN
publisher
Entity: a book
23
Entity-Relationship Model
Domain of Attribute
24
Entity-Relationship Model
Domain of Attribute
Attribute
stud_id
name
dob
Date
sex
Entity-Relationship Model
Attribute
Attribute value
stud_id
s0012
name
dob
#1997/1/1#
sex
Attribute
Attribute value
stud_id
s0022
name
dob
#1998/2/5#
sex
F
26
Entity-Relationship Model
Attribute
Attribute value
ISBN
0-021-74387-6
title
Database System
author
Chan TM
publisher =
EA Education Co.
Attribute
Attribute value
ISBN
0-07-111180-8
title
Network System
author
Peter Chan
publisher =
AB Publication Co.
27
Entity-Relationship Model
Entity Set
Entity-Relationship Model
Entity Set
Entity set:
STUDENT
Entity set:
BOOK
Entity set:
TEACHER
29
Entity-Relationship Model
Entity Set: STUDENT
stud_id
Student 1
Student 3
name
Student 4
Student 5
dob
Student 2
Student 6
Student 7
sex
Entities in the same entity set share the same types of attributes.
30
Entity-Relationship Model
Primary Key
Examples:
Entity-Relationship Model
Attribute
Attribute value
stud_id
s0012
name
dob
#1997/1/1#
sex
Primary key
Attribute
Attribute value
stud_id
s0022
name
dob
#1998/2/5#
sex
F
32
33
Entity-Relationship Model
34
Entity-Relationship Model
Relationship
entity
35
Entity-Relationship Model
Relationship:
Teaches
Student 1
Student 2
Teacher 1
Student 3
Student 4
Teacher 2
Student 5
Teacher 1
Entity Set:
TEACHER
Entity Set:
STUDENT
Student 6
Student 7
36
Entity-Relationship Model
37
Guidelines on Identifying
Entities
38
Guidelines on Identifying
Entities
Remarks:
39
Guidelines on Identifying
Entity set
Entities
Attribute
Attribute value
stud_id
name
dob
sex
=
=
s0012
Chan Tai Man
=
#1997/1/1#
Attribute
Attribute value
=
M
stud_id =
s0022
name
dob
sex
#1998/2/5#
F
Table in database
stud_id
name
dob
sex
s0012
#1997/1/1#
s0022
#1998/2/5#
F
40
Guidelines on Identifying
Attributes
41
Guidelines on Identifying
Relationships
42
Entity Set
Relationship
Buys
Drives
DRIVER,
BUS
The messages on a
USER,
discussion forum were posted MESSAGE
by different users.
Posts
Is_Associated_
With
STUDENT,
ATTENDENCE
43
Example - an Online
Bookstore
Consider the following description of an online
bookstore again.
Example - an Online
Bookstore
45
Example - an Online
Bookstore
The owner of an online bookstore wants to create
an information system for online sale of books.
People will be allowed to register as customers of
the online website. Customer information like
customers correspondence addresses, e-mail
addresses, and credit card numbers are to be
maintained. In a single order, customers will be
allowed to purchase any quantity of books. Items
in a single order will be shipped to the customer.
Here, we identify the entities, attributes and relationships
by using the following colours:
entity
attribute
relationship
46
Example - an Online
Bookstore
Relationship: purchase
47
Example - an Online
Bookstore
Attributes of BOOK:
Book_Rec_No
ISBN
Title
Author
Publisher
Attributes of CUSTOMER:
Customer_ID
Correspondence_address
e-mail
Credit_card_no
48
Example - an Online
Bookstore
Remark:
50
Entity-Relationship Model
51
52
Case Study
53
References
http://en.wikipedia.org/wiki/Entity-relationship_model
54