0% found this document useful (0 votes)
3 views

Integrity_Constraints_DBMS

Integrity constraints are essential rules in databases that ensure data accuracy, consistency, and reliability by preventing invalid entries and maintaining meaningful relationships between tables. The main types include Domain Integrity, Entity Integrity, Referential Integrity, and User-Defined Integrity, each serving specific purposes such as enforcing data types and ensuring uniqueness. Overall, these constraints are crucial for maintaining the integrity of data within a database.

Uploaded by

Shashank Shekhar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Integrity_Constraints_DBMS

Integrity constraints are essential rules in databases that ensure data accuracy, consistency, and reliability by preventing invalid entries and maintaining meaningful relationships between tables. The main types include Domain Integrity, Entity Integrity, Referential Integrity, and User-Defined Integrity, each serving specific purposes such as enforcing data types and ensuring uniqueness. Overall, these constraints are crucial for maintaining the integrity of data within a database.

Uploaded by

Shashank Shekhar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Integrity Constraints in DBMS

Understanding Data Integrity in


Databases
Shashank Shekhar | Techno Main Salt
Lake
Introduction to Integrity
Constraints
• • Integrity constraints are rules enforced on
data in a database to maintain accuracy,
consistency, and reliability.
• • Purpose:
• - Prevents invalid data entry
• - Ensures meaningful relationships between
tables
• - Helps maintain referential integrity
Types of Integrity Constraints
• 1. Domain Integrity Constraint
• - Ensures values fall within a valid range.
• 2. Entity Integrity Constraint
• - Ensures each table has a unique identifier
(Primary Key).
• 3. Referential Integrity Constraint
• - Maintains consistency between related
tables.
• 4. User-Defined Integrity Constraint
Domain Integrity Constraint
• • Ensures values in a column follow a defined
data type and format.
• • Implemented using data types, CHECK
constraints, and DEFAULT values.
• • Example:
• CREATE TABLE Employees (
• EmpID INT PRIMARY KEY,
• Age INT CHECK (Age >= 18)
• );
Entity Integrity Constraint
• • Ensures that each row in a table has a
unique identity.
• • Enforced using PRIMARY KEY constraints.
• • Example:
• CREATE TABLE Students (
• StudentID INT PRIMARY KEY,
• Email VARCHAR(100) UNIQUE
• );
Referential Integrity Constraint
• • Ensures consistency of relationships
between tables.
• • A FOREIGN KEY in one table must reference
a PRIMARY KEY in another.
• • Example:
• CREATE TABLE Orders (
• OrderID INT PRIMARY KEY,
• CustomerID INT,
• FOREIGN KEY (CustomerID) REFERENCES
User-Defined Integrity Constraint
• • Additional business rules applied to data.
• • Can be enforced using CHECK constraints,
triggers, and stored procedures.
• • Example:
• CREATE TABLE Products (
• ProductID INT PRIMARY KEY,
• Discount DECIMAL(5,2) CHECK (Discount <=
50)
• );
Conclusion & Summary
• • Integrity constraints ensure accurate and
meaningful data.
• • Types of integrity constraints:
• - Domain Integrity: Restricts data types.
• - Entity Integrity: Ensures uniqueness.
• - Referential Integrity: Maintains
relationships.
• - User-Defined Integrity: Enforces business
rules.

You might also like