×

Relational Integrity Constraints

Relational Integrity Constraints are the set of rules that can be used to maintain the data integrity during an insert, delete and update operations into a table. These constraints are checked in the database before performing any operation such as insertion, deletion, and updation on the tables.

There are four main types of relational integrity constraints:

  • Key Constraint
  • Domain Constraint
  • Entity Integrity Constraint
  • Referential Integrity Constraint

1. Key Constraint

Every table or relation in a database should have at least one attribute or a set of attributes which uniquely identifies a record. Those attributes or a set of attributes is called key.
For example, rollno in the table ‘Student’ is a key. Two students cannot have the same roll number. So, a key has two features:

It cannot have two values.

It should be unique for all the tuples.

2. Domain Constraint

Domain constraints are the attribute level constraints. A domain is a collection of possible values for an attribute in the database table. An attribute or a field in a table can accept only those values which are inside the domain range.
For example, in the below table Student, the rollno attribute has an integer domain so that an attribute or a field cannot accept values that are not integers,i.e., rollno cannot have values like10.11, ‘first’, etc.

3. Entity Integrity Constraint

Entity constraint specifies that the value of the primary key cannot be NULL. Because, if the primary key has a NULL value, you cannot identify those rows. A field other than the primary key field in a relation can have a NULL value.

Example: In the below table, Student, suppose rollno is the primary key. Thus, from the definition of Entity Integrity constraint, the value of rollno cannot be null as it uniquely identifies each record in the table.

Table: Student

rollno Name City Age
101 Akhil Meerut 20
102 Chetan Delhi 22
103 Anubhav Ghaziabad 21
104 Rishabh Shivam 20

4. Referential Integrity Constraint

A referential integrity constraint is a specified relationship between two tables. It can be defined as when one field of a relation in a database can take the values from another field in the same table or another table. The relationship between the database tables is established by the foreign key.

Example:
Consider two relations Student and Course where rollno is the primary key in the Student table and foreign key in the Course table.

rollno Name City Age
101 Akhil Meerut 20
102 Chetan Delhi 22
103 Anubhav Ghaziabad 21
104 Rishabh Shivam 20

Table: Student

Course_id Course_name rollno
C1 MCA 101
C2 MBA 102
C3 MCA 103
C4 MCA 104

Table: Course


Related Topics

DBMS Architecture

Architecture of Database Management System DBMS architecture helps in development, implementation, design, and maintenance of a database that store and organize information for agencies, businesses, and institutions. It is the base of any database...

2 minutes read.

Why we need Distributed Database Management System

Assuming there is a very strong single machine having properties like: Heaps of memory.Gigantic measure of dependable stockpiling with very quick I/O.Incredible handling rate and processing power (10s, 100s and might...

4 minutes read.

Advantages and Disadvantages of DBMS

We need to understand what is Database Management System before discussing the advantages and disadvantages of the database management system, and also, need to understand what were the technologies and...

5 minutes read.

Cardinality in DBMS

Cardinality in DBMS Cardinality is the relationship between two or more entities (table). It shows how all the entities are connected. In DBMS, all the entities and tables are interconnected with...

2 minutes read.

Normalization in DBMS: 1NF, 2NF, 3NF, BCNF & 4NF with Examples

Normalization is a technique of organizing the data in the database. It is a systematic approach which is used to remove or reduce data redundancy in the tables and remove the...

7 minutes read.

3- Tier Architecture in DBMS

Three-tier architecture is an application software architecture that arranges the output into three parts or tiers that are:  the presentation tier, where the user interacts with the application; the application...

4 minutes read.

Functional Dependencies

Functional Dependencies (FD) in the relational database management system occurs when one attribute in a relation uniquely determines other attribute in that relation. It describes the relation between the attributes. The term functional...

2 minutes read.

Constraints in Database Management System

In a database management system, certain constraints are applied while performing any operation on the database to ensure that the integrity and quality of the data are maintained throughout the...

4 minutes read.

Defference between Database and Data Warehouse

Database A database is a collection of related information is called a database. It has some elements that can be mapped to real-world objects. It is designed in such a manner...

4 minutes read.

Difference between Dropbox and Amazon Drive

What is Dropbox? It is a file organising company that is owned by the American Company Dropbox Inc. Itsheadquarters is situated in San Francisco, California, U.S. Dropbox offers personal cloud, client...

3 minutes read.

Codds Rule of DBMS

Codd’s Rule of DBMS Database having certain constraints and tables, need not to be a relational database system always. For perfect database management system, there are certain rules for the database,...

3 minutes read.

Meta Data in DBMS

Metadata: Metadata is simply described as information about information. It indicates that the data is described as well as its context. It makes data easier to find, interpret, and organize. I'll...

4 minutes read.

Entity and Entity set in DBMS

What is DBMS? A database management system (DBMS) is a software application that interacts with end-users, other applications, and the database itself to capture and analyze the data. A DBMS allows...

3 minutes read.

ER Diagram for Company Database in DBMS

What is ER Diagram? An ER diagram (short for Entity Relationship Diagram), also known as an ERD, is a diagram that shows the relationships of a set of entities stored in...

7 minutes read.

Relational DBMS Concepts

What is RDBMS? RDBMS stands for Relational Database Management System.The relational database management system is a type of DBMS that stores information in the form of related tables and uses a...

3 minutes read.

Generalization in DBMS

Generalization in DBMS In the database management system, generalization is a concept combining the common attributes of two or more lower-level entity and form a new higher level with the common...

3 minutes read.

Redundancy in DBMS

Data redundancy is a situation that is created in the database in which the same amount of data is stored in two different places. The different places are found in a...

3 minutes read.

Aggregate Functions in DBMS

Aggregate Functions in DBMS: Aggregate functions are those functions in the DBMS which takes the values of multiple rows of a single column and then form a single value by...

2 minutes read.

How to draw ER-Diagram in DBMS?

Entity Relationship Diagrams, or ERDs, are diagrams that assist you in visualizing your database design. An ERD, also called anER diagram or ER model,describes data and how parts of the data interact. ERDs are crucial in database architecture and projects that call for...

9 minutes read.

Foreign key in DBMS

Foreign key in DBMS: The Foreign key is a field or the set of fields in the relational database table, which points to the existing field in another table. It...

2 minutes read.