SlideShare a Scribd company logo
1 of 5
Download to read offline
Introdaction to Python
Dr. Mohammed Kassim Page 41
Primary Key & Foreign Key - ERD
The primary key
The primary key is an attribute or a set of attributes that uniquely identify a specific
instance of an entity. Every entity in the data model must have a primary key
whose values uniquely identify instances of the entity.
To qualify as a primary key for an entity, an attribute must have the following
properties:
 It must have a non-null value for each instance of the entity
 The value must be unique for each instance of an entity
 The values must not change or become null during the life of each entity
 The primary key cannot have repeating values
Foreign key
A foreign key is an attribute that completes a relationship by identifying the parent
entity. Foreign keys provide a method for maintaining integrity in the data (called
Primary key
Foreign key
Introdaction to Python
Dr. Mohammed Kassim Page 42
Primary Key & Foreign Key - ERD
referential integrity) and for navigating between different instances of an entity.
Every relationship in the model must be supported by a foreign key.
Primary and foreign keys are the most basic components on which relational
theory is based. Each entity must have an attribute or attributes, the primary key,
whose values uniquely identify each instance of the entity. Every child entity must
have an attribute, the foreign key ,that completes the association with the parent
entity.
Example: design Entity Relationship diagram model for a college?
We have the following statements:
1. A college contains many departments
2. Each department can offer any number of courses
3. Many instructors can work in a department
4. An instructor can work only in one department
5. For each department there is a Head
6. Each instructor can take any number of courses
Introdaction to Python
Dr. Mohammed Kassim Page 43
Primary Key & Foreign Key - ERD
7. A course can be taken by only one instructor
8. A student can enroll for any number of courses
9. Each course can have any number of students
Step 1: Identify the Entities
What are the entities here?
1. Department
2. Course
3. Instructor
4. Student
Stem 2: Identify the relationships
1. One department offers many courses. But one particular course can be
offered by only one department. hence the cardinality between department
and course is One to Many (1:M)
2. One department has multiple instructors . But instructor belongs to only one
department. Hence the cardinality between department and instructor is One
to Many (1:M)
3. One course can be enrolled by many students and one student can enroll for
many courses. Hence the cardinality between course and student is Many to
Many (M:M)
4. One course is taught by only one instructor. But one instructor teaches many
courses. Hence the cardinality between course and instructor is Many to One
(M :1)
Introdaction to Python
Dr. Mohammed Kassim Page 44
Primary Key & Foreign Key - ERD
Step 3: Identify the key attributes
 "Departmen_Name" can identify a department uniquely.
 Course_ID is the key attribute for "Course" Entity.
 Student_ID is the key attribute for "Student" Entity.
 Instructor_ID is the key attribute for "Instructor" Entity.
Step 4: Identify other relevant attributes
For the department entity, other attributes are location
 For course entity, other attributes are course_name,duration
 For instructor entity, other attributes are first_name, last_name, phone
 For student entity, first_name, last_name, phone
Step 5: Draw complete ER diagram
By connecting all these details, we can now draw ER diagram as given below.
Introdaction to Python
Dr. Mohammed Kassim Page 45
Primary Key & Foreign Key - ERD
Entity Relationship (ER) model for a college
M
M
M
M

More Related Content

What's hot

Database Normalization
Database NormalizationDatabase Normalization
Database NormalizationArun Sharma
 
All data models in dbms
All data models in dbmsAll data models in dbms
All data models in dbmsNaresh Kumar
 
Entity Relationship Diagram
Entity Relationship DiagramEntity Relationship Diagram
Entity Relationship DiagramShakila Mahjabin
 
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
FUNCTION DEPENDENCY  AND TYPES & EXAMPLEFUNCTION DEPENDENCY  AND TYPES & EXAMPLE
FUNCTION DEPENDENCY AND TYPES & EXAMPLEVraj Patel
 
Elementary data organisation
Elementary data organisationElementary data organisation
Elementary data organisationMuzamil Hussain
 
Critical section problem in operating system.
Critical section problem in operating system.Critical section problem in operating system.
Critical section problem in operating system.MOHIT DADU
 
1. Introduction to DBMS
1. Introduction to DBMS1. Introduction to DBMS
1. Introduction to DBMSkoolkampus
 
Entity Relationship Diagrams
Entity Relationship DiagramsEntity Relationship Diagrams
Entity Relationship Diagramssadique_ghitm
 
Enhanced Entity-Relationship (EER) Modeling
Enhanced Entity-Relationship (EER) ModelingEnhanced Entity-Relationship (EER) Modeling
Enhanced Entity-Relationship (EER) Modelingsontumax
 
Relational Data Model Introduction
Relational Data Model IntroductionRelational Data Model Introduction
Relational Data Model IntroductionNishant Munjal
 
Free Space Management, Efficiency & Performance, Recovery and NFS
Free Space Management, Efficiency & Performance, Recovery and NFSFree Space Management, Efficiency & Performance, Recovery and NFS
Free Space Management, Efficiency & Performance, Recovery and NFSUnited International University
 
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
 
Previous question papers of Database Management System (DBMS) By SHABEEB
Previous question papers of Database Management System (DBMS) By SHABEEBPrevious question papers of Database Management System (DBMS) By SHABEEB
Previous question papers of Database Management System (DBMS) By SHABEEBShabeeb Shabi
 
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
 
Transaction management DBMS
Transaction  management DBMSTransaction  management DBMS
Transaction management DBMSMegha Patel
 
Dbms relational model
Dbms relational modelDbms relational model
Dbms relational modelChirag vasava
 

What's hot (20)

Database Normalization
Database NormalizationDatabase Normalization
Database Normalization
 
All data models in dbms
All data models in dbmsAll data models in dbms
All data models in dbms
 
Entity Relationship Diagram
Entity Relationship DiagramEntity Relationship Diagram
Entity Relationship Diagram
 
Entity relationship modelling
Entity relationship modellingEntity relationship modelling
Entity relationship modelling
 
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
FUNCTION DEPENDENCY  AND TYPES & EXAMPLEFUNCTION DEPENDENCY  AND TYPES & EXAMPLE
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
 
Elementary data organisation
Elementary data organisationElementary data organisation
Elementary data organisation
 
Critical section problem in operating system.
Critical section problem in operating system.Critical section problem in operating system.
Critical section problem in operating system.
 
1. Introduction to DBMS
1. Introduction to DBMS1. Introduction to DBMS
1. Introduction to DBMS
 
Database Keys
Database KeysDatabase Keys
Database Keys
 
Entity Relationship Diagrams
Entity Relationship DiagramsEntity Relationship Diagrams
Entity Relationship Diagrams
 
Data Models
Data ModelsData Models
Data Models
 
Enhanced Entity-Relationship (EER) Modeling
Enhanced Entity-Relationship (EER) ModelingEnhanced Entity-Relationship (EER) Modeling
Enhanced Entity-Relationship (EER) Modeling
 
Relational Data Model Introduction
Relational Data Model IntroductionRelational Data Model Introduction
Relational Data Model Introduction
 
Normalization in DBMS
Normalization in DBMSNormalization in DBMS
Normalization in DBMS
 
Free Space Management, Efficiency & Performance, Recovery and NFS
Free Space Management, Efficiency & Performance, Recovery and NFSFree Space Management, Efficiency & Performance, Recovery and NFS
Free Space Management, Efficiency & Performance, Recovery and NFS
 
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
 
Previous question papers of Database Management System (DBMS) By SHABEEB
Previous question papers of Database Management System (DBMS) By SHABEEBPrevious question papers of Database Management System (DBMS) By SHABEEB
Previous question papers of Database Management System (DBMS) By SHABEEB
 
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
 
Transaction management DBMS
Transaction  management DBMSTransaction  management DBMS
Transaction management DBMS
 
Dbms relational model
Dbms relational modelDbms relational model
Dbms relational model
 

Similar to Primary Key & Foreign Key part10

Example for ER diagram part11
Example for ER diagram part11Example for ER diagram part11
Example for ER diagram part11DrMohammed Qassim
 
Introduction of Database Design and Development
Introduction of Database Design and DevelopmentIntroduction of Database Design and Development
Introduction of Database Design and DevelopmentEr. Nawaraj Bhandari
 
Introduction to database-ER Model
Introduction to database-ER ModelIntroduction to database-ER Model
Introduction to database-ER ModelAjit Nayak
 
ER Diagram- Cardinality.pptx
ER Diagram- Cardinality.pptxER Diagram- Cardinality.pptx
ER Diagram- Cardinality.pptxSCIENTIFICEARTH
 
Reflective Plan Examples
Reflective Plan ExamplesReflective Plan Examples
Reflective Plan ExamplesMonica Turner
 
Entity-Relationship Data Model
Entity-Relationship Data ModelEntity-Relationship Data Model
Entity-Relationship Data ModelBishrul Haq
 
Object oriented software engineering concepts
Object oriented software engineering conceptsObject oriented software engineering concepts
Object oriented software engineering conceptsKomal Singh
 
E_R-Diagram (2).pptx
E_R-Diagram (2).pptxE_R-Diagram (2).pptx
E_R-Diagram (2).pptxsandeep54552
 
Entity Relationship Modelling
Entity Relationship ModellingEntity Relationship Modelling
Entity Relationship ModellingBhandari Nawaraj
 
Entity Relationship Diagram
Entity Relationship DiagramEntity Relationship Diagram
Entity Relationship DiagramRakhi Mukherji
 
Aptitude questions all topics (1)
Aptitude questions all topics (1)Aptitude questions all topics (1)
Aptitude questions all topics (1)SnehaNallabheem
 
5e7ry754.pptx
5e7ry754.pptx5e7ry754.pptx
5e7ry754.pptxqwert001
 

Similar to Primary Key & Foreign Key part10 (20)

Example for ER diagram part11
Example for ER diagram part11Example for ER diagram part11
Example for ER diagram part11
 
Introduction of Database Design and Development
Introduction of Database Design and DevelopmentIntroduction of Database Design and Development
Introduction of Database Design and Development
 
Er model
Er modelEr model
Er model
 
Database part3-
Database part3-Database part3-
Database part3-
 
Er Modeling
Er ModelingEr Modeling
Er Modeling
 
Introduction to database-ER Model
Introduction to database-ER ModelIntroduction to database-ER Model
Introduction to database-ER Model
 
ER Diagram- Cardinality.pptx
ER Diagram- Cardinality.pptxER Diagram- Cardinality.pptx
ER Diagram- Cardinality.pptx
 
Reflective Plan Examples
Reflective Plan ExamplesReflective Plan Examples
Reflective Plan Examples
 
Entity-Relationship Data Model
Entity-Relationship Data ModelEntity-Relationship Data Model
Entity-Relationship Data Model
 
ER diagram powerpoint
ER diagram powerpointER diagram powerpoint
ER diagram powerpoint
 
Object oriented software engineering concepts
Object oriented software engineering conceptsObject oriented software engineering concepts
Object oriented software engineering concepts
 
E_R-Diagram (2).pptx
E_R-Diagram (2).pptxE_R-Diagram (2).pptx
E_R-Diagram (2).pptx
 
dbms mannual.pdf
dbms mannual.pdfdbms mannual.pdf
dbms mannual.pdf
 
Entity Relationship Modelling
Entity Relationship ModellingEntity Relationship Modelling
Entity Relationship Modelling
 
Entity Relationship Diagram
Entity Relationship DiagramEntity Relationship Diagram
Entity Relationship Diagram
 
ERD.ppt
ERD.pptERD.ppt
ERD.ppt
 
ERD.ppt
ERD.pptERD.ppt
ERD.ppt
 
Aptitude questions all topics (1)
Aptitude questions all topics (1)Aptitude questions all topics (1)
Aptitude questions all topics (1)
 
ER diagram
ER diagramER diagram
ER diagram
 
5e7ry754.pptx
5e7ry754.pptx5e7ry754.pptx
5e7ry754.pptx
 

More from DrMohammed Qassim

Repatino code - hamming code (7,4) - chapter four
Repatino code - hamming code (7,4) - chapter fourRepatino code - hamming code (7,4) - chapter four
Repatino code - hamming code (7,4) - chapter fourDrMohammed Qassim
 
Shannon code & shannon fano & huffman method - chapter three
Shannon code  & shannon fano & huffman method  - chapter threeShannon code  & shannon fano & huffman method  - chapter three
Shannon code & shannon fano & huffman method - chapter threeDrMohammed Qassim
 
ٍSource Entropy - binary symmetric channe - chapter one - two
ٍSource Entropy - binary symmetric channe - chapter one - twoٍSource Entropy - binary symmetric channe - chapter one - two
ٍSource Entropy - binary symmetric channe - chapter one - twoDrMohammed Qassim
 
(Win7) مقدمة في نظام التشغيل
(Win7) مقدمة في نظام التشغيل  (Win7) مقدمة في نظام التشغيل
(Win7) مقدمة في نظام التشغيل DrMohammed Qassim
 
مقدمة في برمجة و تصميم الشبكات
مقدمة في برمجة و تصميم الشبكاتمقدمة في برمجة و تصميم الشبكات
مقدمة في برمجة و تصميم الشبكاتDrMohammed Qassim
 
مقدمة حول الشبكات
مقدمة حول الشبكاتمقدمة حول الشبكات
مقدمة حول الشبكاتDrMohammed Qassim
 
منهاج تحليل و تصميم نظم المعلومات
منهاج تحليل و تصميم نظم المعلوماتمنهاج تحليل و تصميم نظم المعلومات
منهاج تحليل و تصميم نظم المعلوماتDrMohammed Qassim
 
منهاج بناء و تصميم مواقع الانترنيت
منهاج بناء و تصميم مواقع الانترنيتمنهاج بناء و تصميم مواقع الانترنيت
منهاج بناء و تصميم مواقع الانترنيتDrMohammed Qassim
 
مقدمة في قواعد البيانات
مقدمة في قواعد البياناتمقدمة في قواعد البيانات
مقدمة في قواعد البياناتDrMohammed Qassim
 
Entity Relationship Diagram part9
Entity Relationship Diagram part9Entity Relationship Diagram part9
Entity Relationship Diagram part9DrMohammed Qassim
 
Use Case Context Diagram part5
Use Case Context Diagram part5Use Case Context Diagram part5
Use Case Context Diagram part5DrMohammed Qassim
 
System Development Life Cycle part3
System Development Life Cycle part3System Development Life Cycle part3
System Development Life Cycle part3DrMohammed Qassim
 
Introduction to System analysis part1
Introduction to System analysis part1Introduction to System analysis part1
Introduction to System analysis part1DrMohammed Qassim
 
(Protracted your system) حماية نظامك من الدخلاء
(Protracted your system) حماية نظامك من الدخلاء(Protracted your system) حماية نظامك من الدخلاء
(Protracted your system) حماية نظامك من الدخلاءDrMohammed Qassim
 

More from DrMohammed Qassim (20)

Repatino code - hamming code (7,4) - chapter four
Repatino code - hamming code (7,4) - chapter fourRepatino code - hamming code (7,4) - chapter four
Repatino code - hamming code (7,4) - chapter four
 
Shannon code & shannon fano & huffman method - chapter three
Shannon code  & shannon fano & huffman method  - chapter threeShannon code  & shannon fano & huffman method  - chapter three
Shannon code & shannon fano & huffman method - chapter three
 
ٍSource Entropy - binary symmetric channe - chapter one - two
ٍSource Entropy - binary symmetric channe - chapter one - twoٍSource Entropy - binary symmetric channe - chapter one - two
ٍSource Entropy - binary symmetric channe - chapter one - two
 
(Win7) مقدمة في نظام التشغيل
(Win7) مقدمة في نظام التشغيل  (Win7) مقدمة في نظام التشغيل
(Win7) مقدمة في نظام التشغيل
 
مقدمة في برمجة و تصميم الشبكات
مقدمة في برمجة و تصميم الشبكاتمقدمة في برمجة و تصميم الشبكات
مقدمة في برمجة و تصميم الشبكات
 
مقدمة حول الشبكات
مقدمة حول الشبكاتمقدمة حول الشبكات
مقدمة حول الشبكات
 
منهاج تحليل و تصميم نظم المعلومات
منهاج تحليل و تصميم نظم المعلوماتمنهاج تحليل و تصميم نظم المعلومات
منهاج تحليل و تصميم نظم المعلومات
 
منهاج بناء و تصميم مواقع الانترنيت
منهاج بناء و تصميم مواقع الانترنيتمنهاج بناء و تصميم مواقع الانترنيت
منهاج بناء و تصميم مواقع الانترنيت
 
مقدمة في قواعد البيانات
مقدمة في قواعد البياناتمقدمة في قواعد البيانات
مقدمة في قواعد البيانات
 
System analysis part2
System analysis part2System analysis part2
System analysis part2
 
Entity Relationship Diagram part9
Entity Relationship Diagram part9Entity Relationship Diagram part9
Entity Relationship Diagram part9
 
Activity Diagram part8
Activity Diagram part8Activity Diagram part8
Activity Diagram part8
 
Data flow diagram part7
Data flow diagram part7Data flow diagram part7
Data flow diagram part7
 
Data Flow Models part6
Data Flow Models part6Data Flow Models part6
Data Flow Models part6
 
Use Case Context Diagram part5
Use Case Context Diagram part5Use Case Context Diagram part5
Use Case Context Diagram part5
 
Use Case Diagrams part4
Use Case Diagrams part4Use Case Diagrams part4
Use Case Diagrams part4
 
System Development Life Cycle part3
System Development Life Cycle part3System Development Life Cycle part3
System Development Life Cycle part3
 
Introduction to System analysis part1
Introduction to System analysis part1Introduction to System analysis part1
Introduction to System analysis part1
 
Introduction to Python
Introduction to PythonIntroduction to Python
Introduction to Python
 
(Protracted your system) حماية نظامك من الدخلاء
(Protracted your system) حماية نظامك من الدخلاء(Protracted your system) حماية نظامك من الدخلاء
(Protracted your system) حماية نظامك من الدخلاء
 

Recently uploaded

Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech 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
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 

Recently uploaded (20)

Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech 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
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 

Primary Key & Foreign Key part10

  • 1. Introdaction to Python Dr. Mohammed Kassim Page 41 Primary Key & Foreign Key - ERD The primary key The primary key is an attribute or a set of attributes that uniquely identify a specific instance of an entity. Every entity in the data model must have a primary key whose values uniquely identify instances of the entity. To qualify as a primary key for an entity, an attribute must have the following properties:  It must have a non-null value for each instance of the entity  The value must be unique for each instance of an entity  The values must not change or become null during the life of each entity  The primary key cannot have repeating values Foreign key A foreign key is an attribute that completes a relationship by identifying the parent entity. Foreign keys provide a method for maintaining integrity in the data (called Primary key Foreign key
  • 2. Introdaction to Python Dr. Mohammed Kassim Page 42 Primary Key & Foreign Key - ERD referential integrity) and for navigating between different instances of an entity. Every relationship in the model must be supported by a foreign key. Primary and foreign keys are the most basic components on which relational theory is based. Each entity must have an attribute or attributes, the primary key, whose values uniquely identify each instance of the entity. Every child entity must have an attribute, the foreign key ,that completes the association with the parent entity. Example: design Entity Relationship diagram model for a college? We have the following statements: 1. A college contains many departments 2. Each department can offer any number of courses 3. Many instructors can work in a department 4. An instructor can work only in one department 5. For each department there is a Head 6. Each instructor can take any number of courses
  • 3. Introdaction to Python Dr. Mohammed Kassim Page 43 Primary Key & Foreign Key - ERD 7. A course can be taken by only one instructor 8. A student can enroll for any number of courses 9. Each course can have any number of students Step 1: Identify the Entities What are the entities here? 1. Department 2. Course 3. Instructor 4. Student Stem 2: Identify the relationships 1. One department offers many courses. But one particular course can be offered by only one department. hence the cardinality between department and course is One to Many (1:M) 2. One department has multiple instructors . But instructor belongs to only one department. Hence the cardinality between department and instructor is One to Many (1:M) 3. One course can be enrolled by many students and one student can enroll for many courses. Hence the cardinality between course and student is Many to Many (M:M) 4. One course is taught by only one instructor. But one instructor teaches many courses. Hence the cardinality between course and instructor is Many to One (M :1)
  • 4. Introdaction to Python Dr. Mohammed Kassim Page 44 Primary Key & Foreign Key - ERD Step 3: Identify the key attributes  "Departmen_Name" can identify a department uniquely.  Course_ID is the key attribute for "Course" Entity.  Student_ID is the key attribute for "Student" Entity.  Instructor_ID is the key attribute for "Instructor" Entity. Step 4: Identify other relevant attributes For the department entity, other attributes are location  For course entity, other attributes are course_name,duration  For instructor entity, other attributes are first_name, last_name, phone  For student entity, first_name, last_name, phone Step 5: Draw complete ER diagram By connecting all these details, we can now draw ER diagram as given below.
  • 5. Introdaction to Python Dr. Mohammed Kassim Page 45 Primary Key & Foreign Key - ERD Entity Relationship (ER) model for a college M M M M