SlideShare a Scribd company logo
1 of 23
Logical database design
Converting ER diagrams to relational schema
2
Converting Strong entity types
• Each entity type becomes a table
• Each single-valued attribute becomes a column
• Derived attributes are ignored
• Composite attributes are represented by components
• Multi-valued attributes are represented by a separate table
• The key attribute of the entiry type becomes the primary key of the table
3
Entity example
• Here address is a composite
attribute
• Years of service is a derived attribute
(can be calculated from date of
joining and current date)
• Skill set is a multi-valued attribute
• The relational Schema
Employee (E#, Name, Door_No, Street, City, Pincode, Date_Of_Joining)
Emp_Skillset( E#, Skillset)
4
Entity Example (Contd…)
SkillSet
EmpCode FK
Skills
Employee Table
EmpCode PK
EmpName
DateofJoining
SkillSet
5
Converting weak entity types
• Weak entity types are converted
into a table of their own, with the
primary key of the strong entity
acting as a foreign key in the table
• This foreign key along with the key
of the weak entity form the
composite primary key of this table
• The Relational Schema
Employee (E# ,…….)
Dependant (Employee, Dependant_ID, Name, Address)
6
Converting weak entity types (Contd…)
Dependent
EmpCode PK /FK
Dependent_ID PK
Name
Address
Employee Table
EmpCode PK
EmpName
DateofJoining
SkillSet
7
Converting relationships
• The way relationships are represented depends on the cardinality and the degree
of the relationship
• The possible cardinalities are:
1:1, 1:M, N:M
• The degrees are:
Unary
Binary
Ternary …
8
Binary 1:1
• Case 1: Combination of participation types
The primary key of the partial participant will become the foreign key of the total
participant
Employee( E#, Name,…)
Department (Dept#, Name…,MgrE#)
departmentEmployee
Manages1 1
partial
Total
9
Binary 1 : 1
Department
DeptCode PK
DeptName
Location
MgrEmpCode FK
Employee Table
EmpCode PK
EmpName
DateofJoining
SkillSet
10
Binary 1:1
• Case 2: Uniform participation types
The primary key of either of the participants can become a foreign key in the other
Employee (E#,name…)
Chair( item#, model, location, used_by)
(or)
Employee ( E#, Name….Sits_on)
Chair (item#,….)
Employee CHAIRSits_on
11
Binary 1 : 1
Chair
ItemNo PK
Model
Location
Used_By FK
Employee Table
EmpCode PK
EmpName
DateofJoining
SkillSet
Chair
ItemNo PK
Model
Location
Employee Table
EmpCode PK
EmpName
DateofJoining
SkillSet
Sits_On FK
12
Binary 1:N
The primary key of the relation on the “1” side of the relationship becomes a
foreign key in the relation on the “N” side
Teacher (ID, Name, Telephone, ...)
Subject (Code, Name, ..., Teacher)
Teacher teaches Subject
1 N
13
Binary 1 : N
Subject
SubCode PK
SubName
Duration
TeacherID FK
Teacher
TeacherID PK
Name
Telephone
Cabin
14
Binary M:N
• A new table is created to represent the relationship
• Contains two foreign keys - one from each of the participants in the relationship
• The primary key of the new table is the combination of the two foreign keys
Student (Sid#,Title…) Course(C#,CName,…)
Enrolls (Sid#, C#)
Student
Enrolls
Course
M
N
15
Binary M : N
Course
CourseID PK
Coursename
Student
StudentID PK
StudentName
DOB
Address
Enrolls
StudentCode PK / FK
CourseID PK / FK
DOIssue
Status
16
Self referencing 1:1
Employee( E#, Name,... Spouse)
• Consider employees who are also a
couple
• The primary key field itself will become
foreign key in the same table
17
Self referencing 1 : 1
Employee Table
EmpCode PK
EmpName
DateofJoining
SkillSet
Spouse FK
18
Self referencing 1:N
Employee( E#, Name,…,Manager)
• The primary key field itself will
become foreign key in the
same table
• Same as unary 1:1
19
Self referencing 1 : N
Employee Table
EmpCode PK
EmpName
DateofJoining
SkillSet
Manager FK
20
Self referencing M:N
• There will be two resulting tables. One to represent the entity and another to
represent the M:N relationship as follows
Employee( E#, Name,…)
Guaranty( Guarantor, beneficiary)
Employee
Guarantor_of
M
N
21
Self referncing M : N
Guaranty
Guarantor PK/FK
Beneficiary PK /FK
Employee Table
EmpCode PK
EmpName
DateofJoining
SkillSet
22
Ternary relationship
• Represented by a new table
• The new table contains three foreign keys
- one from each of the participating
Entities
• The primary key of the new table is the
combination of all three foreign keys
• Prescription (Doctor#, Patient #,
Medicine_Name)
23
Ternary
Doctor
DocID PK
Title
Prescription
DocID PK / FK
PatCode PK / FK
MedName PK/ FK
NextVisit
Patient
PatCode PK
PatName
DOB
Address
Medicine
MedName PK
ExpDate

More Related Content

What's hot

2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMSkoolkampus
 
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
FUNCTION DEPENDENCY  AND TYPES & EXAMPLEFUNCTION DEPENDENCY  AND TYPES & EXAMPLE
FUNCTION DEPENDENCY AND TYPES & EXAMPLEVraj Patel
 
Relational Data Model Introduction
Relational Data Model IntroductionRelational Data Model Introduction
Relational Data Model IntroductionNishant Munjal
 
Database design & Normalization (1NF, 2NF, 3NF)
Database design & Normalization (1NF, 2NF, 3NF)Database design & Normalization (1NF, 2NF, 3NF)
Database design & Normalization (1NF, 2NF, 3NF)Jargalsaikhan Alyeksandr
 
PL/SQL Introduction and Concepts
PL/SQL Introduction and Concepts PL/SQL Introduction and Concepts
PL/SQL Introduction and Concepts Bharat Kalia
 
Database Concept - Normalization (1NF, 2NF, 3NF)
Database Concept - Normalization (1NF, 2NF, 3NF)Database Concept - Normalization (1NF, 2NF, 3NF)
Database Concept - Normalization (1NF, 2NF, 3NF)Oum Saokosal
 
Relational algebra-and-relational-calculus
Relational algebra-and-relational-calculusRelational algebra-and-relational-calculus
Relational algebra-and-relational-calculusSalman Vadsarya
 
Types Of Join In Sql Server - Join With Example In Sql Server
Types Of Join In Sql Server - Join With Example In Sql ServerTypes Of Join In Sql Server - Join With Example In Sql Server
Types Of Join In Sql Server - Join With Example In Sql Serverprogrammings guru
 
Top Down Parsing, Predictive Parsing
Top Down Parsing, Predictive ParsingTop Down Parsing, Predictive Parsing
Top Down Parsing, Predictive ParsingTanzeela_Hussain
 
Degree of relationship set
Degree of relationship setDegree of relationship set
Degree of relationship setMegha Sharma
 

What's hot (20)

ER Diagram
ER DiagramER Diagram
ER Diagram
 
2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS
 
SQL Join Basic
SQL Join BasicSQL Join Basic
SQL Join Basic
 
Normal forms
Normal formsNormal forms
Normal forms
 
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
FUNCTION DEPENDENCY  AND TYPES & EXAMPLEFUNCTION DEPENDENCY  AND TYPES & EXAMPLE
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
 
ER Model in DBMS
ER Model in DBMSER Model in DBMS
ER Model in DBMS
 
Dbms normalization
Dbms normalizationDbms normalization
Dbms normalization
 
ER to Relational Mapping
ER to Relational MappingER to Relational Mapping
ER to Relational Mapping
 
joins in database
 joins in database joins in database
joins in database
 
Relational Data Model Introduction
Relational Data Model IntroductionRelational Data Model Introduction
Relational Data Model Introduction
 
Database design & Normalization (1NF, 2NF, 3NF)
Database design & Normalization (1NF, 2NF, 3NF)Database design & Normalization (1NF, 2NF, 3NF)
Database design & Normalization (1NF, 2NF, 3NF)
 
Input-Buffering
Input-BufferingInput-Buffering
Input-Buffering
 
PL/SQL Introduction and Concepts
PL/SQL Introduction and Concepts PL/SQL Introduction and Concepts
PL/SQL Introduction and Concepts
 
Database Concept - Normalization (1NF, 2NF, 3NF)
Database Concept - Normalization (1NF, 2NF, 3NF)Database Concept - Normalization (1NF, 2NF, 3NF)
Database Concept - Normalization (1NF, 2NF, 3NF)
 
Relational algebra-and-relational-calculus
Relational algebra-and-relational-calculusRelational algebra-and-relational-calculus
Relational algebra-and-relational-calculus
 
Functional dependency
Functional dependencyFunctional dependency
Functional dependency
 
Types Of Join In Sql Server - Join With Example In Sql Server
Types Of Join In Sql Server - Join With Example In Sql ServerTypes Of Join In Sql Server - Join With Example In Sql Server
Types Of Join In Sql Server - Join With Example In Sql Server
 
Top Down Parsing, Predictive Parsing
Top Down Parsing, Predictive ParsingTop Down Parsing, Predictive Parsing
Top Down Parsing, Predictive Parsing
 
DBMS PPT
DBMS PPTDBMS PPT
DBMS PPT
 
Degree of relationship set
Degree of relationship setDegree of relationship set
Degree of relationship set
 

Similar to ER DIAGRAM TO RELATIONAL SCHEMA MAPPING

Nunes database
Nunes databaseNunes database
Nunes databaseRohini17
 
Assignment statements
Assignment statementsAssignment statements
Assignment statementsDivya Devan
 
Assignment statements
Assignment statementsAssignment statements
Assignment statementsDivya Devan
 
Database - Entity Relationship Diagram (ERD)
Database - Entity Relationship Diagram (ERD)Database - Entity Relationship Diagram (ERD)
Database - Entity Relationship Diagram (ERD)Mudasir Qazi
 
3 relational model
3 relational model3 relational model
3 relational modelUtkarsh De
 
Chapter – 3 Database Design P-II.pdf
Chapter – 3 Database Design P-II.pdfChapter – 3 Database Design P-II.pdf
Chapter – 3 Database Design P-II.pdfTamiratDejene1
 
Advance database system(part 5)
Advance database system(part 5)Advance database system(part 5)
Advance database system(part 5)Abdullah Khosa
 
Databases - Unit 2.pdf
Databases - Unit 2.pdfDatabases - Unit 2.pdf
Databases - Unit 2.pdfCynthiaAdzornu
 
ER Modeling and Introduction to RDBMS
ER Modeling and Introduction to RDBMSER Modeling and Introduction to RDBMS
ER Modeling and Introduction to RDBMSRubal Sagwal
 
Dbms 10: Conversion of ER model to Relational Model
Dbms 10: Conversion of ER model to Relational ModelDbms 10: Conversion of ER model to Relational Model
Dbms 10: Conversion of ER model to Relational ModelAmiya9439793168
 
Unit i b(er model)
Unit i b(er model)Unit i b(er model)
Unit i b(er model)Rohit Rathi
 
7.relational model
7.relational model7.relational model
7.relational modelraghuinfo
 
[Www.pkbulk.blogspot.com]dbms03
[Www.pkbulk.blogspot.com]dbms03[Www.pkbulk.blogspot.com]dbms03
[Www.pkbulk.blogspot.com]dbms03AnusAhmad
 
Schema relationship to E-R diagram
Schema relationship to E-R diagramSchema relationship to E-R diagram
Schema relationship to E-R diagramBadrul Alam
 
Lec4slides
Lec4slidesLec4slides
Lec4slidesshawiz
 
Pokok Bahasan 06 ER-EER to Relational Mapping (1).pdf
Pokok Bahasan 06 ER-EER to Relational Mapping (1).pdfPokok Bahasan 06 ER-EER to Relational Mapping (1).pdf
Pokok Bahasan 06 ER-EER to Relational Mapping (1).pdfjefrifrans
 

Similar to ER DIAGRAM TO RELATIONAL SCHEMA MAPPING (20)

Nunes database
Nunes databaseNunes database
Nunes database
 
Assignment statements
Assignment statementsAssignment statements
Assignment statements
 
Assignment statements
Assignment statementsAssignment statements
Assignment statements
 
Database - Entity Relationship Diagram (ERD)
Database - Entity Relationship Diagram (ERD)Database - Entity Relationship Diagram (ERD)
Database - Entity Relationship Diagram (ERD)
 
3 relational model
3 relational model3 relational model
3 relational model
 
Chapter – 3 Database Design P-II.pdf
Chapter – 3 Database Design P-II.pdfChapter – 3 Database Design P-II.pdf
Chapter – 3 Database Design P-II.pdf
 
Advance database system(part 5)
Advance database system(part 5)Advance database system(part 5)
Advance database system(part 5)
 
3_Relational_Model.pdf
3_Relational_Model.pdf3_Relational_Model.pdf
3_Relational_Model.pdf
 
Databases - Unit 2.pdf
Databases - Unit 2.pdfDatabases - Unit 2.pdf
Databases - Unit 2.pdf
 
ER Modeling and Introduction to RDBMS
ER Modeling and Introduction to RDBMSER Modeling and Introduction to RDBMS
ER Modeling and Introduction to RDBMS
 
Dbms 10: Conversion of ER model to Relational Model
Dbms 10: Conversion of ER model to Relational ModelDbms 10: Conversion of ER model to Relational Model
Dbms 10: Conversion of ER model to Relational Model
 
Unit i b(er model)
Unit i b(er model)Unit i b(er model)
Unit i b(er model)
 
7.relational model
7.relational model7.relational model
7.relational model
 
[Www.pkbulk.blogspot.com]dbms03
[Www.pkbulk.blogspot.com]dbms03[Www.pkbulk.blogspot.com]dbms03
[Www.pkbulk.blogspot.com]dbms03
 
Lex Tool
Lex ToolLex Tool
Lex Tool
 
Schema relationship to E-R diagram
Schema relationship to E-R diagramSchema relationship to E-R diagram
Schema relationship to E-R diagram
 
Lec4slides
Lec4slidesLec4slides
Lec4slides
 
ERModel1.pdf
ERModel1.pdfERModel1.pdf
ERModel1.pdf
 
R Algebra.ppt
R Algebra.pptR Algebra.ppt
R Algebra.ppt
 
Pokok Bahasan 06 ER-EER to Relational Mapping (1).pdf
Pokok Bahasan 06 ER-EER to Relational Mapping (1).pdfPokok Bahasan 06 ER-EER to Relational Mapping (1).pdf
Pokok Bahasan 06 ER-EER to Relational Mapping (1).pdf
 

Recently uploaded

Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbuapidays
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...apidays
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 

Recently uploaded (20)

Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 

ER DIAGRAM TO RELATIONAL SCHEMA MAPPING

  • 1. Logical database design Converting ER diagrams to relational schema
  • 2. 2 Converting Strong entity types • Each entity type becomes a table • Each single-valued attribute becomes a column • Derived attributes are ignored • Composite attributes are represented by components • Multi-valued attributes are represented by a separate table • The key attribute of the entiry type becomes the primary key of the table
  • 3. 3 Entity example • Here address is a composite attribute • Years of service is a derived attribute (can be calculated from date of joining and current date) • Skill set is a multi-valued attribute • The relational Schema Employee (E#, Name, Door_No, Street, City, Pincode, Date_Of_Joining) Emp_Skillset( E#, Skillset)
  • 4. 4 Entity Example (Contd…) SkillSet EmpCode FK Skills Employee Table EmpCode PK EmpName DateofJoining SkillSet
  • 5. 5 Converting weak entity types • Weak entity types are converted into a table of their own, with the primary key of the strong entity acting as a foreign key in the table • This foreign key along with the key of the weak entity form the composite primary key of this table • The Relational Schema Employee (E# ,…….) Dependant (Employee, Dependant_ID, Name, Address)
  • 6. 6 Converting weak entity types (Contd…) Dependent EmpCode PK /FK Dependent_ID PK Name Address Employee Table EmpCode PK EmpName DateofJoining SkillSet
  • 7. 7 Converting relationships • The way relationships are represented depends on the cardinality and the degree of the relationship • The possible cardinalities are: 1:1, 1:M, N:M • The degrees are: Unary Binary Ternary …
  • 8. 8 Binary 1:1 • Case 1: Combination of participation types The primary key of the partial participant will become the foreign key of the total participant Employee( E#, Name,…) Department (Dept#, Name…,MgrE#) departmentEmployee Manages1 1 partial Total
  • 9. 9 Binary 1 : 1 Department DeptCode PK DeptName Location MgrEmpCode FK Employee Table EmpCode PK EmpName DateofJoining SkillSet
  • 10. 10 Binary 1:1 • Case 2: Uniform participation types The primary key of either of the participants can become a foreign key in the other Employee (E#,name…) Chair( item#, model, location, used_by) (or) Employee ( E#, Name….Sits_on) Chair (item#,….) Employee CHAIRSits_on
  • 11. 11 Binary 1 : 1 Chair ItemNo PK Model Location Used_By FK Employee Table EmpCode PK EmpName DateofJoining SkillSet Chair ItemNo PK Model Location Employee Table EmpCode PK EmpName DateofJoining SkillSet Sits_On FK
  • 12. 12 Binary 1:N The primary key of the relation on the “1” side of the relationship becomes a foreign key in the relation on the “N” side Teacher (ID, Name, Telephone, ...) Subject (Code, Name, ..., Teacher) Teacher teaches Subject 1 N
  • 13. 13 Binary 1 : N Subject SubCode PK SubName Duration TeacherID FK Teacher TeacherID PK Name Telephone Cabin
  • 14. 14 Binary M:N • A new table is created to represent the relationship • Contains two foreign keys - one from each of the participants in the relationship • The primary key of the new table is the combination of the two foreign keys Student (Sid#,Title…) Course(C#,CName,…) Enrolls (Sid#, C#) Student Enrolls Course M N
  • 15. 15 Binary M : N Course CourseID PK Coursename Student StudentID PK StudentName DOB Address Enrolls StudentCode PK / FK CourseID PK / FK DOIssue Status
  • 16. 16 Self referencing 1:1 Employee( E#, Name,... Spouse) • Consider employees who are also a couple • The primary key field itself will become foreign key in the same table
  • 17. 17 Self referencing 1 : 1 Employee Table EmpCode PK EmpName DateofJoining SkillSet Spouse FK
  • 18. 18 Self referencing 1:N Employee( E#, Name,…,Manager) • The primary key field itself will become foreign key in the same table • Same as unary 1:1
  • 19. 19 Self referencing 1 : N Employee Table EmpCode PK EmpName DateofJoining SkillSet Manager FK
  • 20. 20 Self referencing M:N • There will be two resulting tables. One to represent the entity and another to represent the M:N relationship as follows Employee( E#, Name,…) Guaranty( Guarantor, beneficiary) Employee Guarantor_of M N
  • 21. 21 Self referncing M : N Guaranty Guarantor PK/FK Beneficiary PK /FK Employee Table EmpCode PK EmpName DateofJoining SkillSet
  • 22. 22 Ternary relationship • Represented by a new table • The new table contains three foreign keys - one from each of the participating Entities • The primary key of the new table is the combination of all three foreign keys • Prescription (Doctor#, Patient #, Medicine_Name)
  • 23. 23 Ternary Doctor DocID PK Title Prescription DocID PK / FK PatCode PK / FK MedName PK/ FK NextVisit Patient PatCode PK PatName DOB Address Medicine MedName PK ExpDate

Editor's Notes

  1. Logical database design Process of converting the conceptual model into an equivalent representation in the implementation model (relational/hierarchical/network etc.) We will focus on the relational model Relational database design Convert ER model into relational schema (a specification of the table definitions and their foreign key links) There are well defined rules for this conversion
  2. As per the rules: Derived attributes are ignored Composite attributes are represented by components Multi-valued attributes are represented by a separate table
  3. Here dependant is a weak entity. Dependant doesn’t mean anything to the problem without the information on for which employee the person is a dependant.