0% found this document useful (0 votes)
28 views33 pages

ER Model

Uploaded by

rajputajay0821
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views33 pages

ER Model

Uploaded by

rajputajay0821
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 33

DATABASE

MANAGEMENT
SYSTEM
Contents
 E-R Model

 Various notations used in E-R diagram

 Examples on min-max representation

 Steps for constructing an E-R Model

 One example for practice


E-R Diagram

• E-R model stands for an Entity-Relationship model. It is a high-level data model.


This model is used to define the data elements and relationships for a specified
system.

• It develops a conceptual design for the database. It also develops a very simple
and easy to design view of data.

• In ER modeling, the database structure is portrayed as a diagram called an entity-


relationship diagram.
Components of ER model
Various notations used in E-R Diagram
Various notations used in E-R Diagram
Various notations used in E-R Diagram
REQUIREMENT ANALYSIS:
• Every employee works for one department.
• A department can have many employees.
• New department need not have any employee.

8
Degree-2(binary)

E1 1
E2 2
D1
E3 3
E4 4
D2
E5 5
E6 6
D3

Employee Department
Works for
9
ER
DIAGRAM

N 1
Work For Department
Employee

Min/Max Representation

(1,1) (0,N)
Employee Work For Department

More info could be represented using MIN/Max Method


10
Requirement Analysis:
Every employee is supposed to work on many project and at least on one project. Every
project can have many employees and at least one employee .

Degree-2(binary)

E1
1 P1
E2 2 p2
3 p3
E3 4 P4
5
E4
11

Employee Works_on Project


M N
Employee Works_on Project

(1,M) (1,N)
Employee Works_On Project

12
Requirement Analysis:
Every Department should have a manager & only one employee manages a department.

An Employee can manages only one department.

Degree-2(binary)

E1
1 D1
E2 2 D2
3 D3
E3 4 D4

E4
E5 13

Employee Manages Department


1 1
Employee Manages Department

(0,1) (1,1)
Employee Manages Department

14
RECURSIVE RELATIONSHIP
Employee (as Supervisor)
Supervises Employee (as
Supervisee)
Sup
ervi
1
ses
2
E1 3 E1
supervisor supervisee E2 E2
E3 E3
E4 E4

1 Employee N
(0,N) (0,1)

15
WEAK ENTITY SET

16
CONSTRUCTING AN E-R MODEL
 Before beginning to draw the ER model, read the
requirements specification carefully.
 Document any assumptions you need to make.

1. Identify entities
• list all potential entity types. These are the
object of interest in the system. It is better to
put too many entities at this stage and then
discard them later if necessary.

17
2. REMOVE DUPLICATE
ENTITIES
• Ensure that they really separate entity types or just
two names for the same thing
• Also do not include the system as an entity type
• e.g. if modelling a library, the entity types might be
books, borrowers, etc.

18
3. LIST THE ATTRIBUTES OF EACH
ENTITY
• Ensure that the entity types are really needed.
• Are any of them just attributes of another entity type?
• If so keep them as attributes and cross them off from
the entity list.

19
4.MARK THE PRIMARY
KEYS
• Which attributes uniquely identify instances of
that entity type?
• This may not be possible for weak
entities.

5.Define the relationships

• Examine each entity type to see its


relationship to the others.
20
6.DESCRIBE THE CARDINALITY AND
OPTIONALITY OF THE RELATIONSHIPS

• Examine the constraints between participating


entities.

7.Remove redundant relationships

• Examine the ER model for redundant


relationships.

 ER modelling is an iterative process, so draw several


versions, refining each one until you are happy with it.
Note that there is no one right answer to the problem, but 21
some solutions are better than others!
EXAMPLE
• Design and develop a database of a university for which the details are as follows:
1. It will maintain information about all the colleges in the university like name, contact
number, address.
2. It will maintain information about all the department of each college like department name,
contact number, head of department.
3. It will maintain information about all the courses that are being offered by each department
like course number, course title, year.
4. It will maintain information about all the faculties for each college like name, designation,
qualification, address, contact number.
5. It will maintain information about all the students like name, year, contact number, address.
6. It will maintain information about the progress report of the students like year, grade, rank.
ASSUMPTIONS
o A college can have more than one contact number.

o A student will be having a progress report for each passed year.

o A professor can teach more than one courses and also a course can
be taught by more than one professors.

23
1. IDENTIFY THE ENTITIES
 College
 Department

 Courses

 Faculty

 Student

 Progress_report

24
2. REMOVE DUPLICATES ENTITIES
 In this example we didn’t find any duplicate entity so go
for the next step.

25
3. IDENTIFY THE ATTRIBUTES OF EACH
ENTITY
o College – c_id, c_name, contact_no, c_address .
o Department – d_id, d_name, contact_no, Hod_id.
o Courses – course_no, course_title, year.
o Faculty – F_id, F_name, Designation, qualification,
contact_no, Address.
o Student – S_id, name, year, contact_no, Address.
o Progress_report – report_id, year, grade, rank.

26
4. MARK THE PRIMARY KEY FOR EACH
ENTITY
o College – c_id
o Department – d_id
o Courses – course_id
o Faculty – F_id
o Student – S_id
o Progress_report – report_id

27
5. IDENTIFY THE RELATIONSHIP AMONG THE
ENTITIES

o College – Department
o Department – Faculty
o Faculty – Courses
o Department – Courses
o Department – Student
o Student – Progress_report
28
6. DESCRIBES THE CARDINALITY AMONG
THE ENTITIES

o College – Department (1:N)


o Department – Faculty (1:N)
o Faculty – Courses(M:N)
o Department – Courses(1:N)
o Department – Student (1:M)
o Student – Progress_report (1:N)
29
7. REMOVE REDUNDANT RELATIONSHIPS

o In this example we didn’t find any redundant


relationship so now just draw the E-R diagram.

30
C_id Name Address

1 N 1 N
College has Department Offers Course
1 N
1
Contact_
No
Enroll has
Teaches

N
Student N M

1 Faculty

Stud_Report
31
N
Progress_Report
MAKE AN E-R MODEL OF ONLINE SALES FOR
BIGHIT VIDEO
“ BigHit Video Inc. wants to create an information system
for online sales of movies in both DVD and videotape format.
People will be allowed to register as customers of the online site
and to update their stored information. Informa-tion must be
maintained about customers ’ shipping addresses, e-mail ad-
dresses and credit cards. In a single sale, customers will be
allowed to purchase any quantity of videos. The items in a
single sale will be shipped to a single address and will have a
single credit card charge A customer will be provided with a
virtual shopping cart to store items to be purchased. As each
item is selected, it is added to the shopping cart. When the
customer finishes shopping, he will be directed to a checkout
area where he can purchase all of the items in the shopping
cart. At this time, payment and shipping information is entered.
Once the sale is complete, the shopping cart will be deleted and 32
the customer will be sent a receipt by e-mail.”
THANKS

You might also like