______________________ ______________________ ______________________

Database I Examples of Entity Relationship Diagrams
______________________ ______________________ ______________________ ___________
___________ ______________________ ______________________ ______________________
______________________ ______________________ ______________________ __________
____________ ______________________ ______________________ _____________________
_ ______________________ ______________________ ______________________ _________
_____________ ______________________ ______________________ ____________________
__ ______________________ ______________________ ______________________
2
Prof. Gregorio Perez (gregorio@uninove.br)
Entity Relationship Approach Example:
Company
Example from
OKTakai, ICItaliano, JEFerreira Introduction to Database, DCC-IME-USP, 2005
The company is organized into departments. Each department has a name, one numbe
r and one employee who manages the department. Stores is the start date the empl
oyee began managing the department. A department may have several locations; A D
epartment manages numerous projects, each one has a name, number and location;
2007 Database I - Exem examples - prof. Gregorio Perez
______________________ ______________________ ______________________ ___________
___________ ______________________ ______________________ ______________________
______________________ ______________________ ______________________ __________
____________ ______________________ ______________________ _____________________
_
Entity Relationship Approach Example:
Company
Employee holds up the name, social security number, address, income, gender and
birth date. Every employee is assigned to one department but may work on several
projects, which are not necessarily controlled by the same department. Stores a
re also the number of hours the employee works on each project. It remains also
an indication of employees' direct supervisor of each project; Dependents of eac
h employee are stored for purpose of benefits. For each dependent to store the n
ame, sex, date of birth and relationship with the employee.
2007
Database I - Exem examples - prof. Gregorio Perez
3
______________________
Company
______________________ ______________________ ______________________
Department
Identify Entities

Company
______________________ ______________________ ______________________ ___________
___________ ______________________ ______________________ ______________________
______________________ ______________________ ______________________
Employee
Project
Dependent
2007
Database I - Exem examples - prof. Gregorio Perez
4
______________________ ______________________ ______________________ ___________
___________ ______________________
Example: Company
Relationships
works for
Employee
manages
Department
______________________ ______________________ ______________________ ___________
___________ ______________________ ______________________ ______________________
______________________ ______________________
supervisor supervised
supervise works
controls
Project
Dependent
2007
Database I - Exem examples - prof. Gregorio Perez
5
______________________ ______________________ ______________________ ___________
___________ ______________________ ______________________
Company
Cardinalities
(1, n) work for (1.1) (0.1) manages
Employee
(1.1)

(1.1)
Department
(1.1)
______________________ ______________________ ______________________ ___________
___________ ______________________ ______________________ ______________________
______________________
supervisor supervised
(0.1) (0, n) supervise (1, n)
controls
(1, n) (0, n)
works
Project
(0, n)
Dependent
2007
Database I - Exem examples - prof. Gregorio Perez
6
______________________
Example: Company
______________________ ______________________
name number (1.1) (0.1) manages DataInÍcio (1, n) work in hours (1, n) (0, n)
Attributes
nss nome
name
address gender (1, n) (1.1)
______________________
location (0, n)
works for
______________________ ______________________ ______________________ ___________
___________ ______________________ ______________________ ______________________
______________________ ______________________ ______________________ __________
____________ ______________________ ______________________ _____________________
_
Employee
wage
Department
(1.1)

(1.1)
supervisor supervised
(0.1) (0, n) (0, n) oversees relationship
controls
Project
name location number
Dependent
name sex
2007
nome
Database I - Exem examples - prof. Gregorio Perez 7
Example: Company
Attributes Identifiers
nss DateOfBirth name address sex (1, n) (1,1) manages DataInÍcio (1, n) work in
hours (1, n) (0, n) works to name number (1,1) (0,1) location (0, n)
______________________ ______________________ ______________________ ___________
___________ ______________________ ______________________ ______________________
______________________ ______________________ ______________________ __________
____________ ______________________ ______________________ _____________________
_ ______________________ ______________________ ______________________ _________
_____________ ______________________ ______________________ ____________________
__ ______________________ ______________________ ______________________ ________
______________
Employee
wage
Department
(1.1)
(1.1)
supervisor supervised
(0.1) (0, n) (0, n) oversees relationship
controls
Project
name location number
Dependent
name sex
2007
nome
Database I - Exem examples - prof. Gregorio Perez 8
Entity Relationship Approach Example:
Rent

Example from CA Heuser Project Database, 5th Ed, Ed Sagra Luzzatto A small video
store has around 2,000 DVDs (or video tapes), which loan shall be controlled Ea
ch DVD has a number. For each movie, you must know its title and its category (c
omedy, drama, adventure, ...) Each film gets a handle himself. For each DVD that
is controlled film it contains. For each film there is at least a DVD and each
DVD contains only a movie. A few films need two media
2007
Database I - Exem examples - prof. Gregorio Perez
9
Entity Relationship Approach Example:
______________________ ______________________ ______________________ ___________
___________ ______________________ ______________________ ______________________
______________________ ______________________ ______________________ __________
____________ ______________________ ______________________
10
Rent
Customers may wish to find movies starring your favorite actor. Therefore, it is
necessary to keep the information of the actors who star in every movie. Not ev
ery film has stars. For each actor clients sometimes wish to know the real name
and birth date. The rental company has many registered clients. Only registered
customers can rent DVDs for each client you need to know your first name and you
r last name, your phone and your address. In addition, each client receives a me
mbership number. Finally, we wish to know that each customer has borrowed DVDs.
A customer can have several DVDs in an instant in time. Are not kept historical
records of rents.
2007 Database I - Exem examples - prof. Gregorio Perez
______________________ ______________________ ______________________ ___________
___________ ______________________ ______________________ ______________________
______________________ ______________________ ______________________ __________
____________ ______________________ ______________________ _____________________
_
Rent
Identify Entities
Rental Customer
DVD
Category
Movie
Actor
2007
Database I - Exem examples - prof. Gregorio Perez
11
______________________ ______________________ ______________________ ___________

___________ ______________________ ______________________
Rent
Relationships
DVD
n
n
rent
1
Client
______________________ ______________________ ______________________ ___________
___________ ______________________
Category
1 n 1
Rent
Movie
n
star
n
Actor
______________________ ______________________ ______________________
2007
Database I - Exem examples - prof. Gregorio Perez
12
______________________
Rent
______________________ ______________________ ______________________
name surname
Rent one
Attributes
number one. DVD Media Category name
1 n 1 n n
______________________ ______________________ ______________________ ___________
___________ ______________________ ______________________ ______________________
______________________ ______________________ ______________________ __________
____________ ______________________ ______________________ _____________________
_ ______________________ ______________________ ______________________ _________

_____________ ______________________ ______________________ ____________________
__ ______________________ ______________________ ______________________ ________
______________ ______________________ ______________________ ___________________
___ ______________________ ______________________ ______________________ _______
_______________ ______________________ ______________________ __________________
____ ______________________ ______________________ ______________________ ______
________________
Client
Rent CNPJ
n
address phone number date of birth. Actor stage name
13
name
n
Id movie title
star
popular name
2007
Database I - Exem examples - prof.€Gregorio Perez
Rent
Attributes Identifiers
number one. DVD media code name Category
(1.1) (0, n) (1.1) (1, n) (0, n) rent (0.1)
Customer name surname
Rent CNPJ
(0, n)
phone number address code
(0, n)
name
date of birth. stage name
14
Id movie title
star
Actor
popular name
2007
Database I - Exem examples - prof. Gregorio Perez

Entity Relationship Approach Example:
Scientific Production
Example from CA Heuser Department of Fundamentals of Database IME, USP, 2003 Wan
t to build a database to store information about scientific production of a numb
er of researchers. For each researcher is necessary to know your name and the in
stitution that works (only current), along with the publications of his own. The
institution has as an identifier symbol. In addition, the database should keep
the name and country of the institution. The researcher is identified by institu
tion and by a sequential number that starts at "1" for each institution.
2007 Database I - Exem examples - prof. Gregorio Perez 15
Entity Relationship Approach Example:
______________________ ______________________ ______________________ ___________
___________ ______________________ ______________________ ______________________
______________________ ______________________ ______________________ __________
____________ ______________________ ______________________
16
Scientific Production
Each publication is identified by a number and has a title. For each publication
you need to know also that it references other publications. It should be noted
that a publication can be referenced by several other publications. There are t
wo types of publications, papers in conference proceedings and journal articles.
For jobs in the annals, the database must store, in addition to the congress al
so saw the publication, the numbers of initial and final page of the article in
the Annals. Each session is identified by an acronym and the year in which it oc
curred and it is necessary to know the name and place where the congress took pl
ace. As for the articles in periodicals, in addition to the numbers first and la
st page, we want to know the volume and issue number of journal where the articl
e was published. Each journal has a unique identifier, a publisher and a name.
2007 Database I - Exem examples - prof. Gregorio Perez
______________________ ______________________ ______________________ ___________
___________ ______________________ ______________________ ______________________
______________________ ______________________ ______________________ __________
____________ ______________________ ______________________ _____________________
_
Academic Production
Identify Entities
Congress
Publication
Proceedings Article
Research
Regular Article
Institution
Periodic
2007

Database I - Exem examples - prof. Gregorio Perez
17
______________________ ______________________ ______________________ ___________
___________ ______________________
Academic Production
Relationships
(0, n) referenced reference (0, n) referrer (0, n) (1, n) Authorship
Publication
Research
(0, n)
______________________ ______________________ ______________________ ___________
___________ ______________________ ______________________ ______________________
______________________ ______________________
(1.1)
Proceedings Article
(0, n) (1.1)
Regular Article
(0, n) (1.1)
Institution
Congress
Periodic
2007
Database I - Exem examples - prof. Gregorio Perez
18
______________________
Academic Production
______________________ ______________________
sequential number (0, n) (1, n) Page Authoring final volume number (1,1)
Attributes
publication number (0, n) referenced reference (0, n) referrer
______________________
name
name
______________________ ______________________ ______________________ ___________
___________ ______________________ ______________________ ______________________

______________________ ______________________ ______________________
Publication
Research
(0, n)
Home Page
Proceedings Article
(0, n) (1,1) symbol name
2007
Regular Article
(0, n)
Institution
Country name abbreviation
Congress
years local publisher
(1.1)
Periodic
identifier name
19
Database I - Exem examples - prof. Gregorio Perez
______________________ ______________________ ______________________ ___________
___________
Academic Production
Attributes
publication number (0, n) referenced reference (0, n) referrer
name (0, n) (1, n) Page Authoring final volume number
sequential number
name
______________________ ______________________ ______________________ ___________
___________ ______________________ ______________________ ______________________
______________________ ______________________ ______________________
Publication
Research
(0, n)
Home Page
(1.1)

Proceedings Article
(0, n) (1,1) symbol name
2007
Regular Article
(0, n)
Institution
Country name abbreviation
Congress
years local publisher
(1.1)
Periodic
identifier name
20
Database I - Exem examples - prof. Gregorio Perez
______________________ ______________________ ______________________ ___________
___________ ______________________ ______________________ ______________________
______________________
Bibliography
C. A. Heuser
Project Database, 5th Ed Ed Sagra Luzzatto
C. J. Date
Introduction to Database Systems, 7th Ed Ed Campus
the
______________________ ______________________ ______________________ ___________
___________ ______________________ ______________________
A. Silberschatz, H. Korth and S. F. Sudarshan
Database System, 5th Edition Ed Campus
2007
Database I - Exem examples - prof. Gregorio Perez
21
______________________