SlideShare a Scribd company logo
 Referential integrity is a relational database
concept, which states that table relationships
must always be consistent. In other words, any
foreign key field must agree with the primary key
that is referenced by the foreign key.
 Primary key field changes must be applied to all
foreign keys, or not at all. The same restriction
also applies to foreign keys in that any updates
(but not necessarily deletions) must be
propagated to the primary parent key.
 Databases use tables to organize the
information they contain. They are similar to
spreadsheets, such as Excel, but vastly more
capable for advanced uses.
 Databases function with the use of primary
keys and foreign keys, which maintain the
relationship between the tables.
 The primary key of a database table is a
unique identifier assigned to each record.
Each table will have one or more columns
designated as the primary key. A Social
Security number can be a primary key for a
database listing of employees because each
Social Security number is unique.
 Some database software—such as Microsoft
Access—assigns the primary key
automatically, but the random key has no real
meaning.
 A foreign key is an identifier in a table that
matches the primary key of a different table.
 The foreign key creates the relationship with a
different table, and referential integrity refers to
the relationship between these tables.
 When one table has a foreign key to another
table, the concept of referential integrity states
that you may not add a record to the table that
contains the foreign key unless there is a
corresponding record in the linked table.
 Using a relational database
management system with referential integrity
offers several advantages:
 Prevents the entry of duplicate data
 Prevents one table from pointing to a
nonexistent field in another table.
 Guaranteed consistency between "partnered"
tables
 Prevents the deletion of a record that
contains a value referred to by a foreign key
in another table
 Prevents the addition of a record to a table
that contains a foreign key unless there is a
primary key in the linked table
 Another example of Referential Integrity
is Employee and Department relationship. If we
have dept_id as foreign key in Employee table
than by using referential integrity constraints
we can avoid creating Employee without
department or non existing department. In
short Referential Integrity makes primary key
foreign key relationship viable. Let's first
create Employee and Department table
with primary key, foreign key and referential
Integrity constraints.
 SQL statements in previous slide will create
both Department and Employee table. dept
_id is now foreign key in Employee table.
In this SQL, while creating foreign key we
have specified ON DELETE clause which
tells, what needs to done when a record
from parent table is
deleted. CASCADE referential action allows
to delete or update all matching rows from
child table, after deleting a record in
parent table. This way Referential Integrity
preserve data integrity of relationship.
 In the previous slide, When we inserted first
record in Department table it ran fine but
when we insert a record in Employee table
with dept_id = 2 which is not present in
Department i.e. parent table, failed to
Referential integrity or foreign key constraint
check.
Referential integrity

More Related Content

What's hot

Database Management System
Database Management SystemDatabase Management System
Database Management System
Nishant Munjal
 
15. Transactions in DBMS
15. Transactions in DBMS15. Transactions in DBMS
15. Transactions in DBMS
koolkampus
 
Normal forms
Normal formsNormal forms
Normal forms
Samuel Igbanogu
 
Rdbms
RdbmsRdbms
Sql commands
Sql commandsSql commands
Sql commands
Pooja Dixit
 
database language ppt.pptx
database language ppt.pptxdatabase language ppt.pptx
database language ppt.pptx
Anusha sivakumar
 
Database Management System Introduction
Database Management System IntroductionDatabase Management System Introduction
Database Management System Introduction
Smriti Jain
 
1. Introduction to DBMS
1. Introduction to DBMS1. Introduction to DBMS
1. Introduction to DBMS
koolkampus
 
Data Dictionary
Data DictionaryData Dictionary
Data Dictionary
Vishal Anand
 
Database Normalization by Dr. Kamal Gulati
Database Normalization by Dr. Kamal GulatiDatabase Normalization by Dr. Kamal Gulati
Week 3 Classification of Database Management Systems & Data Modeling
Week 3 Classification of Database Management Systems & Data ModelingWeek 3 Classification of Database Management Systems & Data Modeling
Week 3 Classification of Database Management Systems & Data Modeling
oudesign
 
Introduction to DBMS(For College Seminars)
Introduction to DBMS(For College Seminars)Introduction to DBMS(For College Seminars)
Introduction to DBMS(For College Seminars)
Naman Joshi
 
ADO.NET
ADO.NETADO.NET
ADO.NET
Farzad Wadia
 
Relational Database Design
Relational Database DesignRelational Database Design
Relational Database Design
Archit Saxena
 
Components and Advantages of DBMS
Components and Advantages of DBMSComponents and Advantages of DBMS
Components and Advantages of DBMS
Shubham Joon
 
Main Components Of Database Management Systems.pptx
Main Components Of Database Management Systems.pptxMain Components Of Database Management Systems.pptx
Main Components Of Database Management Systems.pptx
Green University of Bangladesh
 
Relational model
Relational modelRelational model
Relational model
Dabbal Singh Mahara
 
Dbms Introduction and Basics
Dbms Introduction and BasicsDbms Introduction and Basics
Dbms Introduction and Basics
SHIKHA GAUTAM
 
SQL commands
SQL commandsSQL commands
SQL commands
GirdharRatne
 
Relational algebra in dbms
Relational algebra in dbmsRelational algebra in dbms
Relational algebra in dbms
Vignesh Saravanan
 

What's hot (20)

Database Management System
Database Management SystemDatabase Management System
Database Management System
 
15. Transactions in DBMS
15. Transactions in DBMS15. Transactions in DBMS
15. Transactions in DBMS
 
Normal forms
Normal formsNormal forms
Normal forms
 
Rdbms
RdbmsRdbms
Rdbms
 
Sql commands
Sql commandsSql commands
Sql commands
 
database language ppt.pptx
database language ppt.pptxdatabase language ppt.pptx
database language ppt.pptx
 
Database Management System Introduction
Database Management System IntroductionDatabase Management System Introduction
Database Management System Introduction
 
1. Introduction to DBMS
1. Introduction to DBMS1. Introduction to DBMS
1. Introduction to DBMS
 
Data Dictionary
Data DictionaryData Dictionary
Data Dictionary
 
Database Normalization by Dr. Kamal Gulati
Database Normalization by Dr. Kamal GulatiDatabase Normalization by Dr. Kamal Gulati
Database Normalization by Dr. Kamal Gulati
 
Week 3 Classification of Database Management Systems & Data Modeling
Week 3 Classification of Database Management Systems & Data ModelingWeek 3 Classification of Database Management Systems & Data Modeling
Week 3 Classification of Database Management Systems & Data Modeling
 
Introduction to DBMS(For College Seminars)
Introduction to DBMS(For College Seminars)Introduction to DBMS(For College Seminars)
Introduction to DBMS(For College Seminars)
 
ADO.NET
ADO.NETADO.NET
ADO.NET
 
Relational Database Design
Relational Database DesignRelational Database Design
Relational Database Design
 
Components and Advantages of DBMS
Components and Advantages of DBMSComponents and Advantages of DBMS
Components and Advantages of DBMS
 
Main Components Of Database Management Systems.pptx
Main Components Of Database Management Systems.pptxMain Components Of Database Management Systems.pptx
Main Components Of Database Management Systems.pptx
 
Relational model
Relational modelRelational model
Relational model
 
Dbms Introduction and Basics
Dbms Introduction and BasicsDbms Introduction and Basics
Dbms Introduction and Basics
 
SQL commands
SQL commandsSQL commands
SQL commands
 
Relational algebra in dbms
Relational algebra in dbmsRelational algebra in dbms
Relational algebra in dbms
 

Viewers also liked

Celebrity endorsement , Re-positioning and Brand Extension
Celebrity endorsement , Re-positioning and Brand Extension Celebrity endorsement , Re-positioning and Brand Extension
Celebrity endorsement , Re-positioning and Brand Extension
Jubin Raju
 
AtDocHub
AtDocHubAtDocHub
AtDocHub
Satish Rane
 
CAMBRIDGE A2 HISTORY: TRUMAN DOCTRINE 1947
CAMBRIDGE A2 HISTORY: TRUMAN DOCTRINE 1947CAMBRIDGE A2 HISTORY: TRUMAN DOCTRINE 1947
CAMBRIDGE A2 HISTORY: TRUMAN DOCTRINE 1947
George Dumitrache
 
методика ціннісні орієнтації
методика ціннісні орієнтаціїметодика ціннісні орієнтації
методика ціннісні орієнтації
Kyrynyuk
 
Gap - About Gap Inc
Gap - About Gap IncGap - About Gap Inc
Gap - About Gap Inc
Prabuddha Alexander
 
Caligrames
CaligramesCaligrames
Caligrames
Felip Castejon
 
Loadแนวข้อสอบ ครูผู้ช่วย เอกวัดผลและประเมินผลทางการศึกษา สำนักงานคณะกรรมการก...
 Loadแนวข้อสอบ ครูผู้ช่วย เอกวัดผลและประเมินผลทางการศึกษา สำนักงานคณะกรรมการก... Loadแนวข้อสอบ ครูผู้ช่วย เอกวัดผลและประเมินผลทางการศึกษา สำนักงานคณะกรรมการก...
Loadแนวข้อสอบ ครูผู้ช่วย เอกวัดผลและประเมินผลทางการศึกษา สำนักงานคณะกรรมการก...
nawaporn khamseanwong
 
Жири
ЖириЖири
gamma-glutamyltranferase (GGT)
gamma-glutamyltranferase (GGT)gamma-glutamyltranferase (GGT)
gamma-glutamyltranferase (GGT)
Claude EUGENE
 
SI-PI, Ririh Sayekti, Hapzi Ali, Isu Sosial dan Etika Dalam Sistem Informasi ...
SI-PI, Ririh Sayekti, Hapzi Ali, Isu Sosial dan Etika Dalam Sistem Informasi ...SI-PI, Ririh Sayekti, Hapzi Ali, Isu Sosial dan Etika Dalam Sistem Informasi ...
SI-PI, Ririh Sayekti, Hapzi Ali, Isu Sosial dan Etika Dalam Sistem Informasi ...
RIRIHSAYEKTI
 
Power saving maglev
Power saving maglevPower saving maglev
Power saving maglev
Ganesh Amlapure
 
MODEL “TAWA PROFESOR” : IMPLEMENTASI BUDAYA 5B BERBASIS MBS DAN HIDDEN CURR...
MODEL “TAWA PROFESOR”  : IMPLEMENTASI BUDAYA 5B BERBASIS MBS DAN HIDDEN  CURR...MODEL “TAWA PROFESOR”  : IMPLEMENTASI BUDAYA 5B BERBASIS MBS DAN HIDDEN  CURR...
MODEL “TAWA PROFESOR” : IMPLEMENTASI BUDAYA 5B BERBASIS MBS DAN HIDDEN CURR...
Herfen Suryati
 
Integritas Diversity Analytics
Integritas Diversity AnalyticsIntegritas Diversity Analytics
Integritas Diversity Analytics
IntegritasDS
 
Penerapan integritas model stimulasi kepemimpinan melalui bermain peran
Penerapan integritas model stimulasi kepemimpinan melalui bermain peranPenerapan integritas model stimulasi kepemimpinan melalui bermain peran
Penerapan integritas model stimulasi kepemimpinan melalui bermain peran
Rahma Rahmawinasa
 
Academic Integrity Keynote
Academic Integrity KeynoteAcademic Integrity Keynote
Academic Integrity Keynote
Alec Couros
 
Work Life Integrity: The Science Behind Personal Change (DF16)
Work Life Integrity: The Science Behind Personal Change (DF16)Work Life Integrity: The Science Behind Personal Change (DF16)
Work Life Integrity: The Science Behind Personal Change (DF16)
Ayori S
 
Kel cinta diklatpim III Jatinangor 2016: Presentasi Topik Integritas
Kel cinta diklatpim III Jatinangor 2016: Presentasi Topik IntegritasKel cinta diklatpim III Jatinangor 2016: Presentasi Topik Integritas
Kel cinta diklatpim III Jatinangor 2016: Presentasi Topik Integritas
Gus Priyono Koes
 
Ancaman Integritas Indonesia dalam Bidang Ekonomi
Ancaman Integritas Indonesia dalam Bidang EkonomiAncaman Integritas Indonesia dalam Bidang Ekonomi
Ancaman Integritas Indonesia dalam Bidang Ekonomi
Putri Aisyah
 
Integrity slideshow
Integrity slideshowIntegrity slideshow
Integrity slideshow
rjensen
 
Integrity in the Workplace TEAM BUILDING by Amb Juan
Integrity in the Workplace TEAM BUILDING by Amb JuanIntegrity in the Workplace TEAM BUILDING by Amb Juan
Integrity in the Workplace TEAM BUILDING by Amb Juan
AmbassadorZara Jane Juan PEACE INNOVATION
 

Viewers also liked (20)

Celebrity endorsement , Re-positioning and Brand Extension
Celebrity endorsement , Re-positioning and Brand Extension Celebrity endorsement , Re-positioning and Brand Extension
Celebrity endorsement , Re-positioning and Brand Extension
 
AtDocHub
AtDocHubAtDocHub
AtDocHub
 
CAMBRIDGE A2 HISTORY: TRUMAN DOCTRINE 1947
CAMBRIDGE A2 HISTORY: TRUMAN DOCTRINE 1947CAMBRIDGE A2 HISTORY: TRUMAN DOCTRINE 1947
CAMBRIDGE A2 HISTORY: TRUMAN DOCTRINE 1947
 
методика ціннісні орієнтації
методика ціннісні орієнтаціїметодика ціннісні орієнтації
методика ціннісні орієнтації
 
Gap - About Gap Inc
Gap - About Gap IncGap - About Gap Inc
Gap - About Gap Inc
 
Caligrames
CaligramesCaligrames
Caligrames
 
Loadแนวข้อสอบ ครูผู้ช่วย เอกวัดผลและประเมินผลทางการศึกษา สำนักงานคณะกรรมการก...
 Loadแนวข้อสอบ ครูผู้ช่วย เอกวัดผลและประเมินผลทางการศึกษา สำนักงานคณะกรรมการก... Loadแนวข้อสอบ ครูผู้ช่วย เอกวัดผลและประเมินผลทางการศึกษา สำนักงานคณะกรรมการก...
Loadแนวข้อสอบ ครูผู้ช่วย เอกวัดผลและประเมินผลทางการศึกษา สำนักงานคณะกรรมการก...
 
Жири
ЖириЖири
Жири
 
gamma-glutamyltranferase (GGT)
gamma-glutamyltranferase (GGT)gamma-glutamyltranferase (GGT)
gamma-glutamyltranferase (GGT)
 
SI-PI, Ririh Sayekti, Hapzi Ali, Isu Sosial dan Etika Dalam Sistem Informasi ...
SI-PI, Ririh Sayekti, Hapzi Ali, Isu Sosial dan Etika Dalam Sistem Informasi ...SI-PI, Ririh Sayekti, Hapzi Ali, Isu Sosial dan Etika Dalam Sistem Informasi ...
SI-PI, Ririh Sayekti, Hapzi Ali, Isu Sosial dan Etika Dalam Sistem Informasi ...
 
Power saving maglev
Power saving maglevPower saving maglev
Power saving maglev
 
MODEL “TAWA PROFESOR” : IMPLEMENTASI BUDAYA 5B BERBASIS MBS DAN HIDDEN CURR...
MODEL “TAWA PROFESOR”  : IMPLEMENTASI BUDAYA 5B BERBASIS MBS DAN HIDDEN  CURR...MODEL “TAWA PROFESOR”  : IMPLEMENTASI BUDAYA 5B BERBASIS MBS DAN HIDDEN  CURR...
MODEL “TAWA PROFESOR” : IMPLEMENTASI BUDAYA 5B BERBASIS MBS DAN HIDDEN CURR...
 
Integritas Diversity Analytics
Integritas Diversity AnalyticsIntegritas Diversity Analytics
Integritas Diversity Analytics
 
Penerapan integritas model stimulasi kepemimpinan melalui bermain peran
Penerapan integritas model stimulasi kepemimpinan melalui bermain peranPenerapan integritas model stimulasi kepemimpinan melalui bermain peran
Penerapan integritas model stimulasi kepemimpinan melalui bermain peran
 
Academic Integrity Keynote
Academic Integrity KeynoteAcademic Integrity Keynote
Academic Integrity Keynote
 
Work Life Integrity: The Science Behind Personal Change (DF16)
Work Life Integrity: The Science Behind Personal Change (DF16)Work Life Integrity: The Science Behind Personal Change (DF16)
Work Life Integrity: The Science Behind Personal Change (DF16)
 
Kel cinta diklatpim III Jatinangor 2016: Presentasi Topik Integritas
Kel cinta diklatpim III Jatinangor 2016: Presentasi Topik IntegritasKel cinta diklatpim III Jatinangor 2016: Presentasi Topik Integritas
Kel cinta diklatpim III Jatinangor 2016: Presentasi Topik Integritas
 
Ancaman Integritas Indonesia dalam Bidang Ekonomi
Ancaman Integritas Indonesia dalam Bidang EkonomiAncaman Integritas Indonesia dalam Bidang Ekonomi
Ancaman Integritas Indonesia dalam Bidang Ekonomi
 
Integrity slideshow
Integrity slideshowIntegrity slideshow
Integrity slideshow
 
Integrity in the Workplace TEAM BUILDING by Amb Juan
Integrity in the Workplace TEAM BUILDING by Amb JuanIntegrity in the Workplace TEAM BUILDING by Amb Juan
Integrity in the Workplace TEAM BUILDING by Amb Juan
 

Similar to Referential integrity

Fg d
Fg dFg d
Fg d
Taha Khan
 
BIS06 Physical Database Models
BIS06 Physical Database ModelsBIS06 Physical Database Models
BIS06 Physical Database Models
Prithwis Mukerjee
 
BIS06 Physical Database Models
BIS06 Physical Database ModelsBIS06 Physical Database Models
BIS06 Physical Database Models
Prithwis Mukerjee
 
key.pptx
key.pptxkey.pptx
key.pptx
laptophp39
 
Sql interview questions and answers
Sql interview questions and  answersSql interview questions and  answers
Sql interview questions and answers
sheibansari
 
DATABASE CONCEPTS AND PRACTICAL EXAMPLES
DATABASE CONCEPTS AND PRACTICAL EXAMPLESDATABASE CONCEPTS AND PRACTICAL EXAMPLES
DATABASE CONCEPTS AND PRACTICAL EXAMPLES
NathRam2
 
DBMS-Unit-2.pptx
DBMS-Unit-2.pptxDBMS-Unit-2.pptx
DBMS-Unit-2.pptx
Abhinayacheekati
 
The Relational Database Model
The Relational Database ModelThe Relational Database Model
The Relational Database Model
Shishir Aryal
 
Dbms interview questions
Dbms interview questionsDbms interview questions
Dbms interview questions
ambika93
 
Steps towards of sql server developer
Steps towards of sql server developerSteps towards of sql server developer
Steps towards of sql server developer
Ahsan Kabir
 
Sql interview q&a
Sql interview q&aSql interview q&a
Sql interview q&a
Syed Shah
 
Codds rules & keys
Codds rules & keysCodds rules & keys
Codds rules & keys
Balasingham Karthiban
 
Sql
SqlSql
Sql
shenazk
 
153680 sqlinterview
153680  sqlinterview153680  sqlinterview
153680 sqlinterview
zdsgsgdf
 
Sql Interview Questions
Sql Interview QuestionsSql Interview Questions
Sql Interview Questions
arjundwh
 
Sql
SqlSql
Sql
SqlSql
Difference between fact tables and dimension tables
Difference between fact tables and dimension tablesDifference between fact tables and dimension tables
Difference between fact tables and dimension tables
Kamran Haider
 
T-SQL Overview
T-SQL OverviewT-SQL Overview
T-SQL Overview
Ahmed Elbaz
 
B & c
B & cB & c

Similar to Referential integrity (20)

Fg d
Fg dFg d
Fg d
 
BIS06 Physical Database Models
BIS06 Physical Database ModelsBIS06 Physical Database Models
BIS06 Physical Database Models
 
BIS06 Physical Database Models
BIS06 Physical Database ModelsBIS06 Physical Database Models
BIS06 Physical Database Models
 
key.pptx
key.pptxkey.pptx
key.pptx
 
Sql interview questions and answers
Sql interview questions and  answersSql interview questions and  answers
Sql interview questions and answers
 
DATABASE CONCEPTS AND PRACTICAL EXAMPLES
DATABASE CONCEPTS AND PRACTICAL EXAMPLESDATABASE CONCEPTS AND PRACTICAL EXAMPLES
DATABASE CONCEPTS AND PRACTICAL EXAMPLES
 
DBMS-Unit-2.pptx
DBMS-Unit-2.pptxDBMS-Unit-2.pptx
DBMS-Unit-2.pptx
 
The Relational Database Model
The Relational Database ModelThe Relational Database Model
The Relational Database Model
 
Dbms interview questions
Dbms interview questionsDbms interview questions
Dbms interview questions
 
Steps towards of sql server developer
Steps towards of sql server developerSteps towards of sql server developer
Steps towards of sql server developer
 
Sql interview q&a
Sql interview q&aSql interview q&a
Sql interview q&a
 
Codds rules & keys
Codds rules & keysCodds rules & keys
Codds rules & keys
 
Sql
SqlSql
Sql
 
153680 sqlinterview
153680  sqlinterview153680  sqlinterview
153680 sqlinterview
 
Sql Interview Questions
Sql Interview QuestionsSql Interview Questions
Sql Interview Questions
 
Sql
SqlSql
Sql
 
Sql
SqlSql
Sql
 
Difference between fact tables and dimension tables
Difference between fact tables and dimension tablesDifference between fact tables and dimension tables
Difference between fact tables and dimension tables
 
T-SQL Overview
T-SQL OverviewT-SQL Overview
T-SQL Overview
 
B & c
B & cB & c
B & c
 

Recently uploaded

Influence of Marketing Strategy and Market Competition on Business Plan
Influence of Marketing Strategy and Market Competition on Business PlanInfluence of Marketing Strategy and Market Competition on Business Plan
Influence of Marketing Strategy and Market Competition on Business Plan
jerlynmaetalle
 
My burning issue is homelessness K.C.M.O.
My burning issue is homelessness K.C.M.O.My burning issue is homelessness K.C.M.O.
My burning issue is homelessness K.C.M.O.
rwarrenll
 
4th Modern Marketing Reckoner by MMA Global India & Group M: 60+ experts on W...
4th Modern Marketing Reckoner by MMA Global India & Group M: 60+ experts on W...4th Modern Marketing Reckoner by MMA Global India & Group M: 60+ experts on W...
4th Modern Marketing Reckoner by MMA Global India & Group M: 60+ experts on W...
Social Samosa
 
一比一原版(牛布毕业证书)牛津布鲁克斯大学毕业证如何办理
一比一原版(牛布毕业证书)牛津布鲁克斯大学毕业证如何办理一比一原版(牛布毕业证书)牛津布鲁克斯大学毕业证如何办理
一比一原版(牛布毕业证书)牛津布鲁克斯大学毕业证如何办理
74nqk8xf
 
一比一原版(UniSA毕业证书)南澳大学毕业证如何办理
一比一原版(UniSA毕业证书)南澳大学毕业证如何办理一比一原版(UniSA毕业证书)南澳大学毕业证如何办理
一比一原版(UniSA毕业证书)南澳大学毕业证如何办理
slg6lamcq
 
一比一原版(BCU毕业证书)伯明翰城市大学毕业证如何办理
一比一原版(BCU毕业证书)伯明翰城市大学毕业证如何办理一比一原版(BCU毕业证书)伯明翰城市大学毕业证如何办理
一比一原版(BCU毕业证书)伯明翰城市大学毕业证如何办理
dwreak4tg
 
一比一原版(Harvard毕业证书)哈佛大学毕业证如何办理
一比一原版(Harvard毕业证书)哈佛大学毕业证如何办理一比一原版(Harvard毕业证书)哈佛大学毕业证如何办理
一比一原版(Harvard毕业证书)哈佛大学毕业证如何办理
zsjl4mimo
 
End-to-end pipeline agility - Berlin Buzzwords 2024
End-to-end pipeline agility - Berlin Buzzwords 2024End-to-end pipeline agility - Berlin Buzzwords 2024
End-to-end pipeline agility - Berlin Buzzwords 2024
Lars Albertsson
 
Intelligence supported media monitoring in veterinary medicine
Intelligence supported media monitoring in veterinary medicineIntelligence supported media monitoring in veterinary medicine
Intelligence supported media monitoring in veterinary medicine
AndrzejJarynowski
 
一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
slg6lamcq
 
State of Artificial intelligence Report 2023
State of Artificial intelligence Report 2023State of Artificial intelligence Report 2023
State of Artificial intelligence Report 2023
kuntobimo2016
 
STATATHON: Unleashing the Power of Statistics in a 48-Hour Knowledge Extravag...
STATATHON: Unleashing the Power of Statistics in a 48-Hour Knowledge Extravag...STATATHON: Unleashing the Power of Statistics in a 48-Hour Knowledge Extravag...
STATATHON: Unleashing the Power of Statistics in a 48-Hour Knowledge Extravag...
sameer shah
 
一比一原版(Dalhousie毕业证书)达尔豪斯大学毕业证如何办理
一比一原版(Dalhousie毕业证书)达尔豪斯大学毕业证如何办理一比一原版(Dalhousie毕业证书)达尔豪斯大学毕业证如何办理
一比一原版(Dalhousie毕业证书)达尔豪斯大学毕业证如何办理
mzpolocfi
 
一比一原版(Glasgow毕业证书)格拉斯哥大学毕业证如何办理
一比一原版(Glasgow毕业证书)格拉斯哥大学毕业证如何办理一比一原版(Glasgow毕业证书)格拉斯哥大学毕业证如何办理
一比一原版(Glasgow毕业证书)格拉斯哥大学毕业证如何办理
g4dpvqap0
 
一比一原版(UCSF文凭证书)旧金山分校毕业证如何办理
一比一原版(UCSF文凭证书)旧金山分校毕业证如何办理一比一原版(UCSF文凭证书)旧金山分校毕业证如何办理
一比一原版(UCSF文凭证书)旧金山分校毕业证如何办理
nuttdpt
 
Predictably Improve Your B2B Tech Company's Performance by Leveraging Data
Predictably Improve Your B2B Tech Company's Performance by Leveraging DataPredictably Improve Your B2B Tech Company's Performance by Leveraging Data
Predictably Improve Your B2B Tech Company's Performance by Leveraging Data
Kiwi Creative
 
一比一原版(CBU毕业证)卡普顿大学毕业证如何办理
一比一原版(CBU毕业证)卡普顿大学毕业证如何办理一比一原版(CBU毕业证)卡普顿大学毕业证如何办理
一比一原版(CBU毕业证)卡普顿大学毕业证如何办理
ahzuo
 
Population Growth in Bataan: The effects of population growth around rural pl...
Population Growth in Bataan: The effects of population growth around rural pl...Population Growth in Bataan: The effects of population growth around rural pl...
Population Growth in Bataan: The effects of population growth around rural pl...
Bill641377
 
University of New South Wales degree offer diploma Transcript
University of New South Wales degree offer diploma TranscriptUniversity of New South Wales degree offer diploma Transcript
University of New South Wales degree offer diploma Transcript
soxrziqu
 
Challenges of Nation Building-1.pptx with more important
Challenges of Nation Building-1.pptx with more importantChallenges of Nation Building-1.pptx with more important
Challenges of Nation Building-1.pptx with more important
Sm321
 

Recently uploaded (20)

Influence of Marketing Strategy and Market Competition on Business Plan
Influence of Marketing Strategy and Market Competition on Business PlanInfluence of Marketing Strategy and Market Competition on Business Plan
Influence of Marketing Strategy and Market Competition on Business Plan
 
My burning issue is homelessness K.C.M.O.
My burning issue is homelessness K.C.M.O.My burning issue is homelessness K.C.M.O.
My burning issue is homelessness K.C.M.O.
 
4th Modern Marketing Reckoner by MMA Global India & Group M: 60+ experts on W...
4th Modern Marketing Reckoner by MMA Global India & Group M: 60+ experts on W...4th Modern Marketing Reckoner by MMA Global India & Group M: 60+ experts on W...
4th Modern Marketing Reckoner by MMA Global India & Group M: 60+ experts on W...
 
一比一原版(牛布毕业证书)牛津布鲁克斯大学毕业证如何办理
一比一原版(牛布毕业证书)牛津布鲁克斯大学毕业证如何办理一比一原版(牛布毕业证书)牛津布鲁克斯大学毕业证如何办理
一比一原版(牛布毕业证书)牛津布鲁克斯大学毕业证如何办理
 
一比一原版(UniSA毕业证书)南澳大学毕业证如何办理
一比一原版(UniSA毕业证书)南澳大学毕业证如何办理一比一原版(UniSA毕业证书)南澳大学毕业证如何办理
一比一原版(UniSA毕业证书)南澳大学毕业证如何办理
 
一比一原版(BCU毕业证书)伯明翰城市大学毕业证如何办理
一比一原版(BCU毕业证书)伯明翰城市大学毕业证如何办理一比一原版(BCU毕业证书)伯明翰城市大学毕业证如何办理
一比一原版(BCU毕业证书)伯明翰城市大学毕业证如何办理
 
一比一原版(Harvard毕业证书)哈佛大学毕业证如何办理
一比一原版(Harvard毕业证书)哈佛大学毕业证如何办理一比一原版(Harvard毕业证书)哈佛大学毕业证如何办理
一比一原版(Harvard毕业证书)哈佛大学毕业证如何办理
 
End-to-end pipeline agility - Berlin Buzzwords 2024
End-to-end pipeline agility - Berlin Buzzwords 2024End-to-end pipeline agility - Berlin Buzzwords 2024
End-to-end pipeline agility - Berlin Buzzwords 2024
 
Intelligence supported media monitoring in veterinary medicine
Intelligence supported media monitoring in veterinary medicineIntelligence supported media monitoring in veterinary medicine
Intelligence supported media monitoring in veterinary medicine
 
一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
 
State of Artificial intelligence Report 2023
State of Artificial intelligence Report 2023State of Artificial intelligence Report 2023
State of Artificial intelligence Report 2023
 
STATATHON: Unleashing the Power of Statistics in a 48-Hour Knowledge Extravag...
STATATHON: Unleashing the Power of Statistics in a 48-Hour Knowledge Extravag...STATATHON: Unleashing the Power of Statistics in a 48-Hour Knowledge Extravag...
STATATHON: Unleashing the Power of Statistics in a 48-Hour Knowledge Extravag...
 
一比一原版(Dalhousie毕业证书)达尔豪斯大学毕业证如何办理
一比一原版(Dalhousie毕业证书)达尔豪斯大学毕业证如何办理一比一原版(Dalhousie毕业证书)达尔豪斯大学毕业证如何办理
一比一原版(Dalhousie毕业证书)达尔豪斯大学毕业证如何办理
 
一比一原版(Glasgow毕业证书)格拉斯哥大学毕业证如何办理
一比一原版(Glasgow毕业证书)格拉斯哥大学毕业证如何办理一比一原版(Glasgow毕业证书)格拉斯哥大学毕业证如何办理
一比一原版(Glasgow毕业证书)格拉斯哥大学毕业证如何办理
 
一比一原版(UCSF文凭证书)旧金山分校毕业证如何办理
一比一原版(UCSF文凭证书)旧金山分校毕业证如何办理一比一原版(UCSF文凭证书)旧金山分校毕业证如何办理
一比一原版(UCSF文凭证书)旧金山分校毕业证如何办理
 
Predictably Improve Your B2B Tech Company's Performance by Leveraging Data
Predictably Improve Your B2B Tech Company's Performance by Leveraging DataPredictably Improve Your B2B Tech Company's Performance by Leveraging Data
Predictably Improve Your B2B Tech Company's Performance by Leveraging Data
 
一比一原版(CBU毕业证)卡普顿大学毕业证如何办理
一比一原版(CBU毕业证)卡普顿大学毕业证如何办理一比一原版(CBU毕业证)卡普顿大学毕业证如何办理
一比一原版(CBU毕业证)卡普顿大学毕业证如何办理
 
Population Growth in Bataan: The effects of population growth around rural pl...
Population Growth in Bataan: The effects of population growth around rural pl...Population Growth in Bataan: The effects of population growth around rural pl...
Population Growth in Bataan: The effects of population growth around rural pl...
 
University of New South Wales degree offer diploma Transcript
University of New South Wales degree offer diploma TranscriptUniversity of New South Wales degree offer diploma Transcript
University of New South Wales degree offer diploma Transcript
 
Challenges of Nation Building-1.pptx with more important
Challenges of Nation Building-1.pptx with more importantChallenges of Nation Building-1.pptx with more important
Challenges of Nation Building-1.pptx with more important
 

Referential integrity

  • 1.
  • 2.  Referential integrity is a relational database concept, which states that table relationships must always be consistent. In other words, any foreign key field must agree with the primary key that is referenced by the foreign key.  Primary key field changes must be applied to all foreign keys, or not at all. The same restriction also applies to foreign keys in that any updates (but not necessarily deletions) must be propagated to the primary parent key.
  • 3.  Databases use tables to organize the information they contain. They are similar to spreadsheets, such as Excel, but vastly more capable for advanced uses.  Databases function with the use of primary keys and foreign keys, which maintain the relationship between the tables.
  • 4.  The primary key of a database table is a unique identifier assigned to each record. Each table will have one or more columns designated as the primary key. A Social Security number can be a primary key for a database listing of employees because each Social Security number is unique.  Some database software—such as Microsoft Access—assigns the primary key automatically, but the random key has no real meaning.
  • 5.  A foreign key is an identifier in a table that matches the primary key of a different table.  The foreign key creates the relationship with a different table, and referential integrity refers to the relationship between these tables.  When one table has a foreign key to another table, the concept of referential integrity states that you may not add a record to the table that contains the foreign key unless there is a corresponding record in the linked table.
  • 6.  Using a relational database management system with referential integrity offers several advantages:  Prevents the entry of duplicate data  Prevents one table from pointing to a nonexistent field in another table.  Guaranteed consistency between "partnered" tables
  • 7.  Prevents the deletion of a record that contains a value referred to by a foreign key in another table  Prevents the addition of a record to a table that contains a foreign key unless there is a primary key in the linked table
  • 8.  Another example of Referential Integrity is Employee and Department relationship. If we have dept_id as foreign key in Employee table than by using referential integrity constraints we can avoid creating Employee without department or non existing department. In short Referential Integrity makes primary key foreign key relationship viable. Let's first create Employee and Department table with primary key, foreign key and referential Integrity constraints.
  • 9.
  • 10.  SQL statements in previous slide will create both Department and Employee table. dept _id is now foreign key in Employee table. In this SQL, while creating foreign key we have specified ON DELETE clause which tells, what needs to done when a record from parent table is deleted. CASCADE referential action allows to delete or update all matching rows from child table, after deleting a record in parent table. This way Referential Integrity preserve data integrity of relationship.
  • 11.
  • 12.  In the previous slide, When we inserted first record in Department table it ran fine but when we insert a record in Employee table with dept_id = 2 which is not present in Department i.e. parent table, failed to Referential integrity or foreign key constraint check.