Unit-1 E-R Model-30slides 9 Sept24
Unit-1 E-R Model-30slides 9 Sept24
• definition -
• The entity-relationship model (or ER
model) is a way of graphically representing
the logical relationships of entities (or
objects) in order to create a database. The
ER model was first proposed by Peter Pin-
Shan Chen of Massachusetts Institute of
Technology (MIT) in the 1970s
id
Entity-Relationship Model
employee working Department Name
Name
• Might be
• Object with physical existence like
Lect,student,car.
• Object with conceptual or logical existence
like course,job,postion.
– An ENTITY SET is a set of entities of the same type that
share the same properties.
– Example:, companies, trees, Employee etc
E1.
E2 REPRESENT IN
E4
car1
((ABC 123, TEXAS), TK629, Ford Mustang, convertible, 1999, (red, black))
car2
((ABC 123, NEW YORK), WP9872, Nissan 300ZX, 2-door, 2002, (blue))
car3
((VSY 720, TEXAS), TD729, Buick LeSabre, 4-door, 2003, (white, blue))
.
.
.
empid, empname, deptt------entity type
Gaurav,cse,11
Rajiv,cse,12
entity is a thing in the real world with an independent
existance. and entity set is collection or set all entities of a
particular entity type at any point of time.
take an example:
a company have many employees ,and these employees
are defined as entities(e1,e2,e3....) and all these entities
having same attributes are defined under ENTITY TYPE
employee.and set{e1,e2,.....} is called entity set.
entity type is like fruit which is a class .we havn't seen any
"fruit"yet though we have seen instance of fruit like
"apple ,banana,mango etc.hence..
fruit=entity type=EMPLOYEE
apple=entity=e1 or e2 or e3
enity set= bucket of apple,banana ,mango etc={e1,e2......}
• STRONG ENTITY SETS
An entity set containing a key attribute are called strong
entity types or regular entity types.
For example, The STUDENT entity has a key attribute
Roll No which uniquely identifies it, hence is a strong
entity set.
id emp
ENTITY TYPE
RELATIONSHIP TYPE
ATTRIBUTE
KEY ATTRIBUTE
MULTIVALUED ATTRIBUTE
COMPOSITE ATTRIBUTE
DERIVED ATTRIBUTE
E1 R E2 TOTAL PARTICIPATION OF E2 IN R
E1 N
R E2
CARDINALITY RATIO 1:N FOR E 1:E2 IN R
(min,max)
R E STRUCTURAL CONSTRAINT (min, max) ON
PARTICIPATION OF E IN R
Relationships and Relationship
Types (1)
• A relationship relates two or more distinct entities with a
specific meaning. For example, EMPLOYEE John
Smith works on the ProductX PROJECT or EMPLOYEE
Franklin Wong manages the Research DEPARTMENT.
Example relationship instances of the WORKS_FOR
relationship between EMPLOYEE and DEPARTMENT
EMPLOYEE WORKS_FOR DEPARTMENT
r1
e1 d1
e2 r2
e3 r3 d2
e4 r4
d3
e5
r5
e6
r6
e7
r7
Degree of a Relationship Type
• The degree of a relationship type is the number
of participating entity types.
• Example
• For example, in a University database, we might
have entities for Students, Courses, and
Lecturers. Students entity can have attributes like
Rollno, Name, and DeptID. They might have
relationships with Courses and Lecturers.
• Examples of entities:
• Person: Employee, Student, Patient
• Place: Store, Building
• Object: Machine, product, and Car
• Event: Sale, Registration, Renewal
• Concept: Account, Course
One to One Relationship
• When a single instance of an entity is associated with a single
instance of another entity then it is called one to one relationship.
For example, a person has only one passport and a passport is
given to one person.
One to Many Relationship