SlideShare a Scribd company logo
2
Most read
6
Most read
8
Most read
Integrity constraints
Presented by:
Madhav and Varsha
Integrity constraints
Different types of integrity
• There are the domain integrity,
• the entity integrity, t
• he referential integrity and
• the foreign key integrity
constraints.
Integrity
Constraints
Referential
Entity
TupleKey
Domain
Domain Integrity
• Domain integrity means the definition of a valid set of values for an attribute. You
define
- data type,
- lenght or size
- is null value allowed
- is the value unique or not
for an attribute.
You may also define the default value, the range (values in between) and/or specific
values for the attribute. Some DBMS allow you to define the output format and/or input
mask for the attribute.
These definitions ensure that a specific attribute will have a right and proper value in
the database.
Entity Integrity Constraint
• The entity integrity constraint states that primary keys can't be null. There must be a proper value in the
primary key field.
This is because the primary key value is used to identify individual rows in a table. If there were null values for
primary keys, it would mean that we could not indentify those rows.
On the other hand, there can be null values other than primary key fields. Null value means that one doesn't
know the value for that field. Null value is different from zero value or space.
In the Car Rental database in the Car table each car must have a proper and unique Reg_No. There might be
a car whose rate is unknown - maybe the car is broken or it is brand new - i.e. the Rate field has a null value.
See the picture below.
The entity integrity constraints assure that a spesific row in a table can be identified.
• Picture. Car and CarType tables in the Rent database
Referential Integrity Constraint
• The referential integrity constraint is specified between two tables and it is used to maintain the consistency
among rows between the two tables.
The rules are:
1. You can't delete a record from a primary table if matching records exist in a related table.
2. You can't change a primary key value in the primary table if that record has related records.
3. You can't enter a value in the foreign key field of the related table that doesn't exist in the primary key of the
primary table.
4. However, you can enter a Null value in the foreign key, specifying that the records are unrelated.
Examples
Rule 1. You can't delete any of the rows in the CarType table that are visible in the picture since all the car
types are in use in the Car table.
Rule 2. You can't change any of the model_ids in the CarType table since all the car types are in use in the
Car table.
Rule 3. The values that you can enter in the model_id field in the Car table must be in the model_id field in the
CarType table.
Rule 4. The model_id field in the Car table can have a null value which means that the car type of that car in
not known
Foreign Key Integrity
Constraint
• There are two foreign key integrity constraints: cascade update related fields and cascade delete related rows.
These constraints affect the referential integrity constraint.
Cascade Update Related Fields
Any time you change the primary key of a row in the primary table, the foreign key values are updated in the
matching rows in the related table. This constraint overrules rule 2 in the referential integrity constraints.
If this contraint is defined in the relationship between the tables Car and CarType, it is possible to change the
model_id in the CarType table. If one should change the model_id 1 (Ford Focus) to model_id 100 in the
CarType table, the model_ids in the Car table would change from 1 to 100 (cars ABC-112, ABC-122, ABC-
123).
Cascade Delete Related Rows
Any time you delete a row in the primary table, the matching rows are automatically deleted in the related
table. This constraint overrules rule 1 in the referential integrity constraints.
If this contraint is defined in the relationship between the tables Car and CarType, it is possible to delete rows
from the CarType table. If one should delete the Ford Focus row from the CarType table, the cars
ABC-112, ABC-122, ABC-123 would be deleted from the Car table, too. Source: Gillette Cynthia. 2001. MSCE
SQL 2000 Database Design. Chapter 2: Data Modelling. Coriolis Group.
integrity constraints
THNAK YOU

More Related Content

PPTX
Integrity Constraints
PPTX
Functional dependencies in Database Management System
PPTX
Data Dictionary
PPTX
DMBS Indexes.pptx
PPTX
Sql Constraints
PPTX
Types Of Keys in DBMS
PPTX
Relational model
PPTX
Computer Science:Sql Set Operation
Integrity Constraints
Functional dependencies in Database Management System
Data Dictionary
DMBS Indexes.pptx
Sql Constraints
Types Of Keys in DBMS
Relational model
Computer Science:Sql Set Operation

What's hot (20)

PPT
SQL Queries
PPTX
Degree of relationship set
PPTX
SQL JOIN
PPTX
DBMS: Types of keys
PPT
Aggregate functions
PPTX
Data preprocessing in Machine learning
PPTX
DBMS Keys
PPT
PL/SQL Introduction and Concepts
PPTX
Acid properties
PPTX
Introduction of DBMS
PPT
Files Vs DataBase
PPT
Data models
PPTX
Sql clauses by Manan Pasricha
PPT
14. Query Optimization in DBMS
PDF
Sql commands
PDF
Relational algebra in dbms
PPT
Joins in SQL
PPTX
Integrity Constraints
PPTX
Difference between File system And DBMS.pptx
SQL Queries
Degree of relationship set
SQL JOIN
DBMS: Types of keys
Aggregate functions
Data preprocessing in Machine learning
DBMS Keys
PL/SQL Introduction and Concepts
Acid properties
Introduction of DBMS
Files Vs DataBase
Data models
Sql clauses by Manan Pasricha
14. Query Optimization in DBMS
Sql commands
Relational algebra in dbms
Joins in SQL
Integrity Constraints
Difference between File system And DBMS.pptx
Ad

Viewers also liked (16)

PPT
Data integrity
PDF
Sql integrity constraints
PPTX
Sql server ___________session_15(data integrity)
PDF
Sql ch 9 - data integrity
PPTX
Basic example using database component
PDF
Digital Menu Boards Guide 2014
PDF
Database & dbms
PPT
SQL Server - Constraints
PPTX
Slide 6 er strong & weak entity
PPT
Database Relationships
PPTX
Data integrity Dbms presentation 12 cs 18
PDF
Data integrity
PPTX
Concept of Relational Database and Integrity Constraints [DIFFERENCE BETWEEN ...
PDF
Chapter 1 Fundamentals of Database Management System
PPT
Database Management System Introduction
PDF
Presentation on data integrity in Pharmaceutical Industry
Data integrity
Sql integrity constraints
Sql server ___________session_15(data integrity)
Sql ch 9 - data integrity
Basic example using database component
Digital Menu Boards Guide 2014
Database & dbms
SQL Server - Constraints
Slide 6 er strong & weak entity
Database Relationships
Data integrity Dbms presentation 12 cs 18
Data integrity
Concept of Relational Database and Integrity Constraints [DIFFERENCE BETWEEN ...
Chapter 1 Fundamentals of Database Management System
Database Management System Introduction
Presentation on data integrity in Pharmaceutical Industry
Ad

Similar to integrity constraints (20)

PPT
Database Constraints.ppt
PPTX
DBMS Integrity rule
PPT
Integrity Constraints in Database Management System.ppt
PPTX
5. relational structure
PPT
6. Integrity and Security in DBMS
PPT
2e data models
PPT
ER Digramms by Harshal wagh
PDF
Advance database system(part 5)
PPT
6 integrity and security
PPTX
Geek Sync | Data Integrity Demystified - Deborah Melkin | IDERA
PDF
4_RelationalDataModelAndRelationalMapping.pdf
DOCX
Integrity and security
PDF
Understanding about relational database m-square systems inc
PPTX
Referential integrity
PDF
Database management system important topic.pdf
PDF
3 - Integrity Constraints.pdf
PPTX
Relational Model and Relational Algebra.pptx
PPT
Kul 2
PPTX
Database and Data Warehousing-Building Business Intelligence
Database Constraints.ppt
DBMS Integrity rule
Integrity Constraints in Database Management System.ppt
5. relational structure
6. Integrity and Security in DBMS
2e data models
ER Digramms by Harshal wagh
Advance database system(part 5)
6 integrity and security
Geek Sync | Data Integrity Demystified - Deborah Melkin | IDERA
4_RelationalDataModelAndRelationalMapping.pdf
Integrity and security
Understanding about relational database m-square systems inc
Referential integrity
Database management system important topic.pdf
3 - Integrity Constraints.pdf
Relational Model and Relational Algebra.pptx
Kul 2
Database and Data Warehousing-Building Business Intelligence

Recently uploaded (20)

PPTX
Odoo POS Development Services by CandidRoot Solutions
PPTX
Introduction to Artificial Intelligence
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PDF
Digital Strategies for Manufacturing Companies
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PPTX
history of c programming in notes for students .pptx
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PDF
Softaken Excel to vCard Converter Software.pdf
PPTX
ai tools demonstartion for schools and inter college
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
Nekopoi APK 2025 free lastest update
PPTX
L1 - Introduction to python Backend.pptx
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
Odoo POS Development Services by CandidRoot Solutions
Introduction to Artificial Intelligence
wealthsignaloriginal-com-DS-text-... (1).pdf
Digital Strategies for Manufacturing Companies
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
VVF-Customer-Presentation2025-Ver1.9.pptx
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
history of c programming in notes for students .pptx
Design an Analysis of Algorithms I-SECS-1021-03
2025 Textile ERP Trends: SAP, Odoo & Oracle
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
Softaken Excel to vCard Converter Software.pdf
ai tools demonstartion for schools and inter college
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
How to Choose the Right IT Partner for Your Business in Malaysia
Nekopoi APK 2025 free lastest update
L1 - Introduction to python Backend.pptx
How to Migrate SBCGlobal Email to Yahoo Easily

integrity constraints

  • 3. Different types of integrity • There are the domain integrity, • the entity integrity, t • he referential integrity and • the foreign key integrity constraints.
  • 5. Domain Integrity • Domain integrity means the definition of a valid set of values for an attribute. You define - data type, - lenght or size - is null value allowed - is the value unique or not for an attribute. You may also define the default value, the range (values in between) and/or specific values for the attribute. Some DBMS allow you to define the output format and/or input mask for the attribute. These definitions ensure that a specific attribute will have a right and proper value in the database.
  • 6. Entity Integrity Constraint • The entity integrity constraint states that primary keys can't be null. There must be a proper value in the primary key field. This is because the primary key value is used to identify individual rows in a table. If there were null values for primary keys, it would mean that we could not indentify those rows. On the other hand, there can be null values other than primary key fields. Null value means that one doesn't know the value for that field. Null value is different from zero value or space. In the Car Rental database in the Car table each car must have a proper and unique Reg_No. There might be a car whose rate is unknown - maybe the car is broken or it is brand new - i.e. the Rate field has a null value. See the picture below. The entity integrity constraints assure that a spesific row in a table can be identified. • Picture. Car and CarType tables in the Rent database
  • 7. Referential Integrity Constraint • The referential integrity constraint is specified between two tables and it is used to maintain the consistency among rows between the two tables. The rules are: 1. You can't delete a record from a primary table if matching records exist in a related table. 2. You can't change a primary key value in the primary table if that record has related records. 3. You can't enter a value in the foreign key field of the related table that doesn't exist in the primary key of the primary table. 4. However, you can enter a Null value in the foreign key, specifying that the records are unrelated. Examples Rule 1. You can't delete any of the rows in the CarType table that are visible in the picture since all the car types are in use in the Car table. Rule 2. You can't change any of the model_ids in the CarType table since all the car types are in use in the Car table. Rule 3. The values that you can enter in the model_id field in the Car table must be in the model_id field in the CarType table. Rule 4. The model_id field in the Car table can have a null value which means that the car type of that car in not known
  • 8. Foreign Key Integrity Constraint • There are two foreign key integrity constraints: cascade update related fields and cascade delete related rows. These constraints affect the referential integrity constraint. Cascade Update Related Fields Any time you change the primary key of a row in the primary table, the foreign key values are updated in the matching rows in the related table. This constraint overrules rule 2 in the referential integrity constraints. If this contraint is defined in the relationship between the tables Car and CarType, it is possible to change the model_id in the CarType table. If one should change the model_id 1 (Ford Focus) to model_id 100 in the CarType table, the model_ids in the Car table would change from 1 to 100 (cars ABC-112, ABC-122, ABC- 123). Cascade Delete Related Rows Any time you delete a row in the primary table, the matching rows are automatically deleted in the related table. This constraint overrules rule 1 in the referential integrity constraints. If this contraint is defined in the relationship between the tables Car and CarType, it is possible to delete rows from the CarType table. If one should delete the Ford Focus row from the CarType table, the cars ABC-112, ABC-122, ABC-123 would be deleted from the Car table, too. Source: Gillette Cynthia. 2001. MSCE SQL 2000 Database Design. Chapter 2: Data Modelling. Coriolis Group.