SlideShare una empresa de Scribd logo
1 de 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

Más contenido relacionado

La actualidad más candente

Er model ppt
Er model pptEr model ppt
Er model pptPihu Goel
 
2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMSkoolkampus
 
Functional dependencies in Database Management System
Functional dependencies in Database Management SystemFunctional dependencies in Database Management System
Functional dependencies in Database Management SystemKevin Jadiya
 
Er & eer to relational mapping
Er & eer to relational mappingEr & eer to relational mapping
Er & eer to relational mappingsaurabhshertukde
 
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
 
Class and object in C++
Class and object in C++Class and object in C++
Class and object in C++rprajat007
 
Inheritance in c++
Inheritance in c++Inheritance in c++
Inheritance in c++Vineeta Garg
 
Relational Algebra,Types of join
Relational Algebra,Types of joinRelational Algebra,Types of join
Relational Algebra,Types of joinraj upadhyay
 
SQL, Embedded SQL, Dynamic SQL and SQLJ
SQL, Embedded SQL, Dynamic SQL and SQLJSQL, Embedded SQL, Dynamic SQL and SQLJ
SQL, Embedded SQL, Dynamic SQL and SQLJDharita Chokshi
 
Bsc cs ii-dbms-u-iv-normalization
Bsc cs ii-dbms-u-iv-normalizationBsc cs ii-dbms-u-iv-normalization
Bsc cs ii-dbms-u-iv-normalizationRai University
 
Functional dependencies and normalization
Functional dependencies and normalizationFunctional dependencies and normalization
Functional dependencies and normalizationdaxesh chauhan
 
Relational algebra ppt
Relational algebra pptRelational algebra ppt
Relational algebra pptGirdharRatne
 
Dbms Notes Lecture 9 : Specialization, Generalization and Aggregation
Dbms Notes Lecture 9 : Specialization, Generalization and AggregationDbms Notes Lecture 9 : Specialization, Generalization and Aggregation
Dbms Notes Lecture 9 : Specialization, Generalization and AggregationBIT Durg
 

La actualidad más candente (20)

Er model ppt
Er model pptEr model ppt
Er model ppt
 
ER Model in DBMS
ER Model in DBMSER Model in DBMS
ER Model in DBMS
 
2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS
 
Normalization in DBMS
Normalization in DBMSNormalization in DBMS
Normalization in DBMS
 
Functional dependencies in Database Management System
Functional dependencies in Database Management SystemFunctional dependencies in Database Management System
Functional dependencies in Database Management System
 
SQL commands
SQL commandsSQL commands
SQL commands
 
DBMS PPT
DBMS PPTDBMS PPT
DBMS PPT
 
Er & eer to relational mapping
Er & eer to relational mappingEr & eer to relational mapping
Er & eer to relational mapping
 
Database Concept - Normalization (1NF, 2NF, 3NF)
Database Concept - Normalization (1NF, 2NF, 3NF)Database Concept - Normalization (1NF, 2NF, 3NF)
Database Concept - Normalization (1NF, 2NF, 3NF)
 
Class and object in C++
Class and object in C++Class and object in C++
Class and object in C++
 
Inheritance in c++
Inheritance in c++Inheritance in c++
Inheritance in c++
 
Relational Algebra,Types of join
Relational Algebra,Types of joinRelational Algebra,Types of join
Relational Algebra,Types of join
 
SQL, Embedded SQL, Dynamic SQL and SQLJ
SQL, Embedded SQL, Dynamic SQL and SQLJSQL, Embedded SQL, Dynamic SQL and SQLJ
SQL, Embedded SQL, Dynamic SQL and SQLJ
 
Structures in c++
Structures in c++Structures in c++
Structures in c++
 
ER model
ER modelER model
ER model
 
Bsc cs ii-dbms-u-iv-normalization
Bsc cs ii-dbms-u-iv-normalizationBsc cs ii-dbms-u-iv-normalization
Bsc cs ii-dbms-u-iv-normalization
 
Functional dependencies and normalization
Functional dependencies and normalizationFunctional dependencies and normalization
Functional dependencies and normalization
 
SQL(DDL & DML)
SQL(DDL & DML)SQL(DDL & DML)
SQL(DDL & DML)
 
Relational algebra ppt
Relational algebra pptRelational algebra ppt
Relational algebra ppt
 
Dbms Notes Lecture 9 : Specialization, Generalization and Aggregation
Dbms Notes Lecture 9 : Specialization, Generalization and AggregationDbms Notes Lecture 9 : Specialization, Generalization and Aggregation
Dbms Notes Lecture 9 : Specialization, Generalization and Aggregation
 

Destacado

Functional dependencies and normalization for relational databases
Functional dependencies and normalization for relational databasesFunctional dependencies and normalization for relational databases
Functional dependencies and normalization for relational databasesJafar Nesargi
 
Entity Relationship Model
Entity Relationship ModelEntity Relationship Model
Entity Relationship ModelSlideshare
 
Entity Relationship Diagram
Entity Relationship DiagramEntity Relationship Diagram
Entity Relationship DiagramShakila Mahjabin
 
Entity relationship diagram (erd)
Entity relationship diagram (erd)Entity relationship diagram (erd)
Entity relationship diagram (erd)tameemyousaf
 
Airline reservation system documentation
Airline reservation system documentationAirline reservation system documentation
Airline reservation system documentationSurya Indira
 
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
 

Destacado (7)

Crj 3 1-b
Crj 3 1-bCrj 3 1-b
Crj 3 1-b
 
Functional dependencies and normalization for relational databases
Functional dependencies and normalization for relational databasesFunctional dependencies and normalization for relational databases
Functional dependencies and normalization for relational databases
 
Entity Relationship Model
Entity Relationship ModelEntity Relationship Model
Entity Relationship Model
 
Entity Relationship Diagram
Entity Relationship DiagramEntity Relationship Diagram
Entity Relationship Diagram
 
Entity relationship diagram (erd)
Entity relationship diagram (erd)Entity relationship diagram (erd)
Entity relationship diagram (erd)
 
Airline reservation system documentation
Airline reservation system documentationAirline reservation system documentation
Airline reservation system documentation
 
Database design & Normalization (1NF, 2NF, 3NF)
Database design & Normalization (1NF, 2NF, 3NF)Database design & Normalization (1NF, 2NF, 3NF)
Database design & Normalization (1NF, 2NF, 3NF)
 

Similar a 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 a 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
 

Último

MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
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
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
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
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
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
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfOverkill Security
 
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
 
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
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 

Último (20)

MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
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...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
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
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
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
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
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
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 

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

Notas del editor

  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.