SlideShare a Scribd company logo
Conceptual design & ER Model
4/3/2023
Computer Science Dept. MIT ACSC
Alandi(D)
Conceptual design
• Issues to consider: (ER Model is used at this stage.)
– What are the entities and relationships in the enterprise?
– What information about these entities and relationships
should we store in the database (i.e., attributes)?
– What are the integrity constraints or business rules that
hold?
• Solution:
– A database `schema’ in the ER Model can be represented
pictorially (ER diagrams).
– Can map an ER diagram into a relational schema.
4/3/2023
Computer Science Dept. MIT ACSC
Alandi(D)
ER Model Basics
Employees
ssn
name
lot
4/3/2023
Computer Science Dept. MIT ACSC
Alandi(D)
ER Model Basics
• Entity: Real-world object distinguishable from other objects.
An entity is described (in DB) using a set of
attributes.
• Entity Set: A collection of similar entities. E.g., all employees.
– All entities in an entity set have the same set of attributes.
– Each entity set has a key.
– Each attribute has a domain.
4/3/2023
Computer Science Dept. MIT ACSC
Alandi(D)
Key
• A key is a minimal set of attributes whose
values uniquely identify an entity in the set.
• Candidate key.
• Primary key.
4/3/2023
Computer Science Dept. MIT ACSC
Alandi(D)
ER Model Basics
• Relationship: Association among 2 or more
entities. E.g., Sam works in the Accounting Department.
• Relationship Set: Collection of similar
relationships.
– An n-ary relationship set R relates n entity sets
E1 ... En; each relationship in R involves entities e1
E1, ..., en En
• Same entity set could participate in different
relationship sets, or in different “roles” in same set.
4/3/2023
Computer Science Dept. MIT ACSC
Alandi(D)
• Build an ER Diagram for the following
information:
– Students
• Have an Id, Name, Login, Age, GPA
– Courses
• Have an Id, Name, Credit Hours
– Students enroll in courses
• Receive a grade
4/3/2023
Computer Science Dept. MIT ACSC
Alandi(D)
Example 1 Answer
Students
Name Login
Id
Age
GPA
Courses
Id Name Credit
Enrolled_In
Grade
4/3/2023
Computer Science Dept. MIT ACSC
Alandi(D)
Constraints
• Key constraints
• Participation constraints
4/3/2023
Computer Science Dept. MIT ACSC
Alandi(D)
Many-to-Many
1-to-1 1-to Many Many-to-1
Potential Relationship Types
4/3/2023
Computer Science Dept. MIT ACSC
Alandi(D)
Potential Relationship Types
• Mary studies in the CS Dept.
• Tom studies in the CS Dept.
• Jack studies in the CS Dept.
• …
• The CS Dept has lots of students.
• No student in the CS Dept works in other else Dept at the same
time.
Students CS Dept
IN
? ?
4/3/2023
Computer Science Dept. MIT ACSC
Alandi(D)
Potential Relationship Types
• Mary is taking the ITCS3160,ITCS2212.
• Tom is taking the ITCS3160, ITCS2214.
• Jack is taking the ITCS1102, ITCS2214.
• …
• 61 students are taking ITCS3160.
• 120 students are taking ITCS2214.
Students Courses
take
? ?
4/3/2023
Computer Science Dept. MIT ACSC
Alandi(D)
lot
dname
budget
did
since
name
Works_In Departments
Employees
ssn
Key Constraints
Consider Works_In:
An employee can work
in many departments;
a dept can have many employees.
4/3/2023
Computer Science Dept. MIT ACSC
Alandi(D)
lot
dname
budget
did
since
name
Works_In Departments
Employees
ssn
Key Constraints
Consider Works_In:
An employee can work
in at most one department;
a dept can have many employees.
4/3/2023
Computer Science Dept. MIT ACSC
Alandi(D)
Key Constraints
• In contrast, each dept
has at most one
manager, according to
the key constraint on
Manages.
dname
budget
did
since
lot
name
ssn
Manages
Employees Departments
Key Constraint
(time constraint)
At most one!!!
4/3/2023
Computer Science Dept. MIT ACSC
Alandi(D)
Participation Constraints
• Does every department have a manager?
– If so, this is a participation constraint: the participation
of Departments in Manages is said to be total (vs.
partial).
• Every did value in Departments table must appear in a row of
the Manages table (with a non-null ssn value!)
lot
name dname
budget
did
since
name dname
budget
did
since
Manages
since
Departments
Employees
ssn
Works_In
Total w/key
constraint
Partial
Total
Total
4/3/2023
Computer Science Dept. MIT ACSC
Alandi(D)
lot
name dname
budget
did
since
name dname
budget
did
since
Manages
since
Departments
Employees
ssn
Works_In
Total w/key
constraint
Total
Total
Total
What are the policies behind this ER model?
4/3/2023
Computer Science Dept. MIT ACSC
Alandi(D)
lot
name dname
budget
did
since
name dname
budget
did
since
Manages
since
Departments
Employees
ssn
Works_In
Total w/key
constraint
Partial
Total
Total
dname
budget
did
since
lot
name
ssn
Manages
Employees Departments
Works_In
Any Difference?
4/3/2023
Computer Science Dept. MIT ACSC
Alandi(D)
Weak Entities vs. Owner Entities
• A weak entity can be identified uniquely only by
considering the primary key of another (owner)
entity.
– Owner entity set and weak entity set must participate in
a one-to-many relationship set (1 owner, many weak
entities).
– Weak entity set must have total participation in this
identifying relationship set.
lot
name
age
pname
Dependents
Employees
ssn
Policy
cost
Weak Entity
Identifying Relationship
Primary Key
for weak entity
4/3/2023
Computer Science Dept. MIT ACSC
Alandi(D)
dname
budget
did
name
Departments
ssn lot
Employees Works_In3
Duration
from to
Ternary Relationship
lot
dname
budget
did
since
name
Works_In Departments
Employees
ssn
Why?
4/3/2023
Computer Science Dept. MIT ACSC
Alandi(D)
ISA (`is a’) Hierarchies
Contract_Emps
name
ssn
Employees
lot
hourly_wages
ISA
Hourly_Emps
contractid
hours_worked
As in C++, or other PLs, attributes are
inherited.
If we declare A ISA B, every A entity is also
considered to be a B entity.
• Overlap constraints: Can Joe be an Hourly_Emps as well as a
Contract_Emps entity? (Allowed/disallowed)
• Covering constraints: Does every Employees entity also have to be
an Hourly_Emps or a Contract_Emps entity? (Yes/no)
• Reasons for using ISA:
– To add descriptive attributes specific to a subclass.
– To identify entitities that participate in a relationship.
4/3/2023
Computer Science Dept. MIT ACSC
Alandi(D)
Aggregation
• Used when we have to
model a relationship
involving (entitity sets
and) a relationship set.
– Aggregation allows us
to treat a relationship
set as an entity set for
purposes of
participation in (other)
relationships.
– Monitors mapped to
table like any other
relationship set.
budget
did
pid
started_on
pbudget
dname
until
Departments
Projects Sponsors
Employees
Monitors
lot
name
ssn
Aggregation
4/3/2023
Computer Science Dept. MIT ACSC
Alandi(D)
Real Database Design
• Build an ER Diagram for the following information:
– Walmart Stores
• Store Id, Address, Phone #
– Products
• Product Id, Description, Price
– Manufacturers
• Name, Address, Phone #
– Walmart Stores carry products
• Amount in store
– Manufacturers make products
• Amount in factory/warehouses
4/3/2023
Computer Science Dept. MIT ACSC
Alandi(D)
Conceptual Design Using the ER Model
• Design choices:
– Should a concept be modeled as an entity or an attribute?
– Should a concept be modeled as an entity or a relationship?
– Identifying relationships: Binary or Ternary? Aggregation?
Always follow the requirements.
4/3/2023
Computer Science Dept. MIT ACSC
Alandi(D)
Entity vs. Attribute
• Should address be an attribute of Employees or
an entity (connected to Employees by a
relationship)?
• Depends upon the use we want to make of
address information, and the semantics of the
data:
• If we have several addresses per employee, address must be
an entity (since attributes cannot be set-valued).
• If the structure (city, street, etc.) is important, e.g., we want
to retrieve employees in a given city, address must be
modeled as an entity (since attribute values are atomic).
4/3/2023
Computer Science Dept. MIT ACSC
Alandi(D)
Entity vs. Attribute (Contd.)
• Works_In2 does not allow
an employee to work in a
department for two or
more periods.
• Similar to the problem of
wanting to record several
addresses for an employee:
we want to record several
values of the descriptive
attributes for each instance
of this relationship.
name
Employees
ssn lot
Works_In2
from to
dname
budget
did
Departments
dname
budget
did
name
Departments
ssn lot
Employees Works_In3
Duration
from to
4/3/2023
Computer Science Dept. MIT ACSC
Alandi(D)
Entity vs. Relationship
• First ER diagram OK if a
manager gets a separate
discretionary budget for
each dept.
– Redundancy of dbudget,
which is stored for each
dept managed by the
manager.
– Misleading: suggests
dbudget tied to managed
dept.
• What if a manager gets a
discretionary budget that
covers all managed depts?
Manages2
name dname
budget
did
Employees Departments
ssn lot
dbudget
since
Employees
since
name dname
budget
did
Departments
ssn lot
Mgr_Appts
Manages3
dbudget
apptnum
4/3/2023
Computer Science Dept. MIT ACSC
Alandi(D)
Binary vs. Ternary Relationships
• If each policy is
owned by just 1
employee:
– Key constraint on
Policies would
mean policy can
only cover 1
dependent!
age
pname
Dependents
Covers
name
Employees
ssn lot
Policies
policyid cost
Beneficiary
age
pname
Dependents
policyid cost
Policies
Purchaser
name
Employees
ssn lot
Bad design
Better design
*
4/3/2023
Computer Science Dept. MIT ACSC
Alandi(D)
Binary vs. Ternary Relationships
(Contd.)
• Previous example illustrated a case when binary relationships
were better than one ternary relationship.
• An example in the other direction: a ternary relation Contracts
relates entity set Parts, Departments and Suppliers, and has
descriptive attributes qty. No combination of binary
relationships is an adequate substitute:
– S can supply P, D needs P, and D deals-with S does not imply that D has
agreed to buy P from S.
– How do we record qty?
4/3/2023
Computer Science Dept. MIT ACSC
Alandi(D)

More Related Content

PPT
2. Entity Relationship Model in DBMS
PPTX
Relational model
PPTX
database language ppt.pptx
PPT
Dbms relational model
PPTX
Relational Algebra,Types of join
PPTX
Relational Database Design
PPT
DBMS PPT
2. Entity Relationship Model in DBMS
Relational model
database language ppt.pptx
Dbms relational model
Relational Algebra,Types of join
Relational Database Design
DBMS PPT

What's hot (20)

PPT
11. Storage and File Structure in DBMS
PDF
Additional Relational Algebra Operations
PPT
ER-Model-ER Diagram
PPT
Codd's rules
PPTX
Conceptual Data Modeling
PPTX
Two-way Deterministic Finite Automata
PPTX
Normal forms
PPTX
Relational Data Model Introduction
PPTX
Entity (types, attibute types)
PPT
15. Transactions in DBMS
PPT
Data independence
PPTX
Database abstraction
PPTX
Integrity Constraints
PPT
13. Query Processing in DBMS
PDF
Chapter 2 Relational Data Model-part1
PPTX
DBMS Integrity rule
PPTX
The Relational Database Model
PPTX
Extended relational algebra
PPTX
Dbms architecture
11. Storage and File Structure in DBMS
Additional Relational Algebra Operations
ER-Model-ER Diagram
Codd's rules
Conceptual Data Modeling
Two-way Deterministic Finite Automata
Normal forms
Relational Data Model Introduction
Entity (types, attibute types)
15. Transactions in DBMS
Data independence
Database abstraction
Integrity Constraints
13. Query Processing in DBMS
Chapter 2 Relational Data Model-part1
DBMS Integrity rule
The Relational Database Model
Extended relational algebra
Dbms architecture
Ad

Similar to Conceptual design & ER Model.pptx (20)

PDF
Conceptual Data Modelling Using ER-models
PDF
Profile Analysis of Users in Data Analytics Domain
PDF
DBMS_Chapter3mklkjjkhgffgjtdjdffgfygyfty.pdf
PPTX
Datamodels.pptx
PDF
Mapping Domain Names to Categories
DOCX
CIS 515 Enhance teaching / snaptutorial.com
DOC
Cis 515 Effective Communication-snaptutorial.com
PDF
ITB - UNIT 3.pdf
PDF
Physical Database Requirements.pdf
PDF
Cs8492 Database Management System 20182019 Department Of Csr It
DOCX
CIS 515 Education Organization / snaptutorial.com
PDF
03 CHAPTER TWO - CONCEPTUAL DATABASE DESIGN.pdf
PPTX
03 CHAPTER TWO - CONCEPTUAL DATABASE DESIGN.pptx
PPTX
Introduction to Database Management Systems
PDF
Database Design and the ER Model, Indexing and Hashing
PPTX
Machine Learning 2 deep Learning: An Intro
PDF
Dad (Data Analysis And Design)
PPTX
Database Concepts and Components
PDF
Systems Analysis and Design 6th Edition Dennis Test Bank
PDF
Systems Analysis and Design 6th Edition Dennis Test Bank
Conceptual Data Modelling Using ER-models
Profile Analysis of Users in Data Analytics Domain
DBMS_Chapter3mklkjjkhgffgjtdjdffgfygyfty.pdf
Datamodels.pptx
Mapping Domain Names to Categories
CIS 515 Enhance teaching / snaptutorial.com
Cis 515 Effective Communication-snaptutorial.com
ITB - UNIT 3.pdf
Physical Database Requirements.pdf
Cs8492 Database Management System 20182019 Department Of Csr It
CIS 515 Education Organization / snaptutorial.com
03 CHAPTER TWO - CONCEPTUAL DATABASE DESIGN.pdf
03 CHAPTER TWO - CONCEPTUAL DATABASE DESIGN.pptx
Introduction to Database Management Systems
Database Design and the ER Model, Indexing and Hashing
Machine Learning 2 deep Learning: An Intro
Dad (Data Analysis And Design)
Database Concepts and Components
Systems Analysis and Design 6th Edition Dennis Test Bank
Systems Analysis and Design 6th Edition Dennis Test Bank
Ad

Recently uploaded (20)

PDF
Phytochemical Investigation of Miliusa longipes.pdf
PPT
The World of Physical Science, • Labs: Safety Simulation, Measurement Practice
PPTX
cpcsea ppt.pptxssssssssssssssjjdjdndndddd
PPTX
Derivatives of integument scales, beaks, horns,.pptx
PPTX
Microbiology with diagram medical studies .pptx
DOCX
Viruses (History, structure and composition, classification, Bacteriophage Re...
PPTX
Taita Taveta Laboratory Technician Workshop Presentation.pptx
PPTX
ANEMIA WITH LEUKOPENIA MDS 07_25.pptx htggtftgt fredrctvg
PDF
bbec55_b34400a7914c42429908233dbd381773.pdf
PDF
IFIT3 RNA-binding activity primores influenza A viruz infection and translati...
PDF
Formation of Supersonic Turbulence in the Primordial Star-forming Cloud
PPTX
BIOMOLECULES PPT........................
PPTX
ognitive-behavioral therapy, mindfulness-based approaches, coping skills trai...
PPTX
EPIDURAL ANESTHESIA ANATOMY AND PHYSIOLOGY.pptx
PPTX
G5Q1W8 PPT SCIENCE.pptx 2025-2026 GRADE 5
PPTX
Comparative Structure of Integument in Vertebrates.pptx
PPTX
2. Earth - The Living Planet Module 2ELS
PPTX
The KM-GBF monitoring framework – status & key messages.pptx
PPTX
INTRODUCTION TO EVS | Concept of sustainability
PDF
Biophysics 2.pdffffffffffffffffffffffffff
Phytochemical Investigation of Miliusa longipes.pdf
The World of Physical Science, • Labs: Safety Simulation, Measurement Practice
cpcsea ppt.pptxssssssssssssssjjdjdndndddd
Derivatives of integument scales, beaks, horns,.pptx
Microbiology with diagram medical studies .pptx
Viruses (History, structure and composition, classification, Bacteriophage Re...
Taita Taveta Laboratory Technician Workshop Presentation.pptx
ANEMIA WITH LEUKOPENIA MDS 07_25.pptx htggtftgt fredrctvg
bbec55_b34400a7914c42429908233dbd381773.pdf
IFIT3 RNA-binding activity primores influenza A viruz infection and translati...
Formation of Supersonic Turbulence in the Primordial Star-forming Cloud
BIOMOLECULES PPT........................
ognitive-behavioral therapy, mindfulness-based approaches, coping skills trai...
EPIDURAL ANESTHESIA ANATOMY AND PHYSIOLOGY.pptx
G5Q1W8 PPT SCIENCE.pptx 2025-2026 GRADE 5
Comparative Structure of Integument in Vertebrates.pptx
2. Earth - The Living Planet Module 2ELS
The KM-GBF monitoring framework – status & key messages.pptx
INTRODUCTION TO EVS | Concept of sustainability
Biophysics 2.pdffffffffffffffffffffffffff

Conceptual design & ER Model.pptx

  • 1. Conceptual design & ER Model 4/3/2023 Computer Science Dept. MIT ACSC Alandi(D)
  • 2. Conceptual design • Issues to consider: (ER Model is used at this stage.) – What are the entities and relationships in the enterprise? – What information about these entities and relationships should we store in the database (i.e., attributes)? – What are the integrity constraints or business rules that hold? • Solution: – A database `schema’ in the ER Model can be represented pictorially (ER diagrams). – Can map an ER diagram into a relational schema. 4/3/2023 Computer Science Dept. MIT ACSC Alandi(D)
  • 4. ER Model Basics • Entity: Real-world object distinguishable from other objects. An entity is described (in DB) using a set of attributes. • Entity Set: A collection of similar entities. E.g., all employees. – All entities in an entity set have the same set of attributes. – Each entity set has a key. – Each attribute has a domain. 4/3/2023 Computer Science Dept. MIT ACSC Alandi(D)
  • 5. Key • A key is a minimal set of attributes whose values uniquely identify an entity in the set. • Candidate key. • Primary key. 4/3/2023 Computer Science Dept. MIT ACSC Alandi(D)
  • 6. ER Model Basics • Relationship: Association among 2 or more entities. E.g., Sam works in the Accounting Department. • Relationship Set: Collection of similar relationships. – An n-ary relationship set R relates n entity sets E1 ... En; each relationship in R involves entities e1 E1, ..., en En • Same entity set could participate in different relationship sets, or in different “roles” in same set. 4/3/2023 Computer Science Dept. MIT ACSC Alandi(D)
  • 7. • Build an ER Diagram for the following information: – Students • Have an Id, Name, Login, Age, GPA – Courses • Have an Id, Name, Credit Hours – Students enroll in courses • Receive a grade 4/3/2023 Computer Science Dept. MIT ACSC Alandi(D)
  • 8. Example 1 Answer Students Name Login Id Age GPA Courses Id Name Credit Enrolled_In Grade 4/3/2023 Computer Science Dept. MIT ACSC Alandi(D)
  • 9. Constraints • Key constraints • Participation constraints 4/3/2023 Computer Science Dept. MIT ACSC Alandi(D)
  • 10. Many-to-Many 1-to-1 1-to Many Many-to-1 Potential Relationship Types 4/3/2023 Computer Science Dept. MIT ACSC Alandi(D)
  • 11. Potential Relationship Types • Mary studies in the CS Dept. • Tom studies in the CS Dept. • Jack studies in the CS Dept. • … • The CS Dept has lots of students. • No student in the CS Dept works in other else Dept at the same time. Students CS Dept IN ? ? 4/3/2023 Computer Science Dept. MIT ACSC Alandi(D)
  • 12. Potential Relationship Types • Mary is taking the ITCS3160,ITCS2212. • Tom is taking the ITCS3160, ITCS2214. • Jack is taking the ITCS1102, ITCS2214. • … • 61 students are taking ITCS3160. • 120 students are taking ITCS2214. Students Courses take ? ? 4/3/2023 Computer Science Dept. MIT ACSC Alandi(D)
  • 13. lot dname budget did since name Works_In Departments Employees ssn Key Constraints Consider Works_In: An employee can work in many departments; a dept can have many employees. 4/3/2023 Computer Science Dept. MIT ACSC Alandi(D)
  • 14. lot dname budget did since name Works_In Departments Employees ssn Key Constraints Consider Works_In: An employee can work in at most one department; a dept can have many employees. 4/3/2023 Computer Science Dept. MIT ACSC Alandi(D)
  • 15. Key Constraints • In contrast, each dept has at most one manager, according to the key constraint on Manages. dname budget did since lot name ssn Manages Employees Departments Key Constraint (time constraint) At most one!!! 4/3/2023 Computer Science Dept. MIT ACSC Alandi(D)
  • 16. Participation Constraints • Does every department have a manager? – If so, this is a participation constraint: the participation of Departments in Manages is said to be total (vs. partial). • Every did value in Departments table must appear in a row of the Manages table (with a non-null ssn value!) lot name dname budget did since name dname budget did since Manages since Departments Employees ssn Works_In Total w/key constraint Partial Total Total 4/3/2023 Computer Science Dept. MIT ACSC Alandi(D)
  • 17. lot name dname budget did since name dname budget did since Manages since Departments Employees ssn Works_In Total w/key constraint Total Total Total What are the policies behind this ER model? 4/3/2023 Computer Science Dept. MIT ACSC Alandi(D)
  • 18. lot name dname budget did since name dname budget did since Manages since Departments Employees ssn Works_In Total w/key constraint Partial Total Total dname budget did since lot name ssn Manages Employees Departments Works_In Any Difference? 4/3/2023 Computer Science Dept. MIT ACSC Alandi(D)
  • 19. Weak Entities vs. Owner Entities • A weak entity can be identified uniquely only by considering the primary key of another (owner) entity. – Owner entity set and weak entity set must participate in a one-to-many relationship set (1 owner, many weak entities). – Weak entity set must have total participation in this identifying relationship set. lot name age pname Dependents Employees ssn Policy cost Weak Entity Identifying Relationship Primary Key for weak entity 4/3/2023 Computer Science Dept. MIT ACSC Alandi(D)
  • 20. dname budget did name Departments ssn lot Employees Works_In3 Duration from to Ternary Relationship lot dname budget did since name Works_In Departments Employees ssn Why? 4/3/2023 Computer Science Dept. MIT ACSC Alandi(D)
  • 21. ISA (`is a’) Hierarchies Contract_Emps name ssn Employees lot hourly_wages ISA Hourly_Emps contractid hours_worked As in C++, or other PLs, attributes are inherited. If we declare A ISA B, every A entity is also considered to be a B entity. • Overlap constraints: Can Joe be an Hourly_Emps as well as a Contract_Emps entity? (Allowed/disallowed) • Covering constraints: Does every Employees entity also have to be an Hourly_Emps or a Contract_Emps entity? (Yes/no) • Reasons for using ISA: – To add descriptive attributes specific to a subclass. – To identify entitities that participate in a relationship. 4/3/2023 Computer Science Dept. MIT ACSC Alandi(D)
  • 22. Aggregation • Used when we have to model a relationship involving (entitity sets and) a relationship set. – Aggregation allows us to treat a relationship set as an entity set for purposes of participation in (other) relationships. – Monitors mapped to table like any other relationship set. budget did pid started_on pbudget dname until Departments Projects Sponsors Employees Monitors lot name ssn Aggregation 4/3/2023 Computer Science Dept. MIT ACSC Alandi(D)
  • 23. Real Database Design • Build an ER Diagram for the following information: – Walmart Stores • Store Id, Address, Phone # – Products • Product Id, Description, Price – Manufacturers • Name, Address, Phone # – Walmart Stores carry products • Amount in store – Manufacturers make products • Amount in factory/warehouses 4/3/2023 Computer Science Dept. MIT ACSC Alandi(D)
  • 24. Conceptual Design Using the ER Model • Design choices: – Should a concept be modeled as an entity or an attribute? – Should a concept be modeled as an entity or a relationship? – Identifying relationships: Binary or Ternary? Aggregation? Always follow the requirements. 4/3/2023 Computer Science Dept. MIT ACSC Alandi(D)
  • 25. Entity vs. Attribute • Should address be an attribute of Employees or an entity (connected to Employees by a relationship)? • Depends upon the use we want to make of address information, and the semantics of the data: • If we have several addresses per employee, address must be an entity (since attributes cannot be set-valued). • If the structure (city, street, etc.) is important, e.g., we want to retrieve employees in a given city, address must be modeled as an entity (since attribute values are atomic). 4/3/2023 Computer Science Dept. MIT ACSC Alandi(D)
  • 26. Entity vs. Attribute (Contd.) • Works_In2 does not allow an employee to work in a department for two or more periods. • Similar to the problem of wanting to record several addresses for an employee: we want to record several values of the descriptive attributes for each instance of this relationship. name Employees ssn lot Works_In2 from to dname budget did Departments dname budget did name Departments ssn lot Employees Works_In3 Duration from to 4/3/2023 Computer Science Dept. MIT ACSC Alandi(D)
  • 27. Entity vs. Relationship • First ER diagram OK if a manager gets a separate discretionary budget for each dept. – Redundancy of dbudget, which is stored for each dept managed by the manager. – Misleading: suggests dbudget tied to managed dept. • What if a manager gets a discretionary budget that covers all managed depts? Manages2 name dname budget did Employees Departments ssn lot dbudget since Employees since name dname budget did Departments ssn lot Mgr_Appts Manages3 dbudget apptnum 4/3/2023 Computer Science Dept. MIT ACSC Alandi(D)
  • 28. Binary vs. Ternary Relationships • If each policy is owned by just 1 employee: – Key constraint on Policies would mean policy can only cover 1 dependent! age pname Dependents Covers name Employees ssn lot Policies policyid cost Beneficiary age pname Dependents policyid cost Policies Purchaser name Employees ssn lot Bad design Better design * 4/3/2023 Computer Science Dept. MIT ACSC Alandi(D)
  • 29. Binary vs. Ternary Relationships (Contd.) • Previous example illustrated a case when binary relationships were better than one ternary relationship. • An example in the other direction: a ternary relation Contracts relates entity set Parts, Departments and Suppliers, and has descriptive attributes qty. No combination of binary relationships is an adequate substitute: – S can supply P, D needs P, and D deals-with S does not imply that D has agreed to buy P from S. – How do we record qty? 4/3/2023 Computer Science Dept. MIT ACSC Alandi(D)