DBMS Concepts

DBMS Tutorial Components of DBMS. Applications of DBMS The difference between file system and DBMS. Types of DBMS DBMS Architecture DBMS Schema Three Schema Architecture. DBMS Languages.

DBMS ER Model

ER model: Entity Relationship Diagram (ERD) Components of ER Model. DBMS Generalization, Specialization and Aggregation.

DBMS Relational Model

Codd’s rule of DBMS Relational DBMS concepts Relational Integrity Constraints DBMS keys Convert ER model into Relational model Difference between DBMS and RDBMS Relational Algebra DBMS Joins

DBMS Normalization

Functional Dependency Inference Rules Multivalued Dependency Normalization in DBMS: 1NF, 2NF, 3NF, BCNF and 4NF

DBMS Transaction

What is Transaction? States of transaction ACID Properties in DBMS Concurrent execution and its problems DBMS schedule DBMS Serializability Conflict Serializability View Serializability Deadlock in DBMS Concurrency control Protocols

Difference

Difference between DFD and ERD

Misc

Advantages of DBMS Disadvantages of DBMS Data Models in DBMS Relational Algebra in DBMS Cardinality in DBMS Entity in DBMS Attributes in DBMS Data Independence in DBMS Primary Key in DBMS Foreign Key in DBMS Candidate Key in DBMS Super Key in DBMS Aggregation in DBMS Hashing in DBMS Generalization in DBMS Specialization in DBMS View in DBMS File Organization in DBMS What Is A Cloud Database What Is A Database Levels Of Locking In DBMS What is RDBMS Fragmentation in Distributed DBMS What is Advanced Database Management System Data Abstraction in DBMS Checkpoint In DBMS B Tree in DBMS BCNF in DBMS Advantages of Threaded Binary Tree in DBMS Advantages of Database Management System in DBMS Enforcing Integrity Constraints in DBMS B-Tree Insertion in DBMS B+ Tree in DBMS Advantages of B-Tree in DBMS Types of Data Abstraction in DBMS Levels of Abstraction in DBMS 3- Tier Architecture in DBMS Anomalies in Database Management System Atomicity in Database Management System Characteristics of DBMS DBMS Examples Difference between Relational and Non-Relational Databases Domain Constraints in DBMS Entity and Entity set in DBMS ER Diagram for Banking System in DBMS ER Diagram for Company Database in DBMS ER Diagram for School Management System in DBMS ER Diagram for Student Management System in DBMS ER Diagram for University Database in DBMS ER Diagram of Company Database in DBMS Er Diagram Symbols and Notations in DBMS How to draw ER-Diagram in DBMS Integrity Constraints in DBMS Red-Black Tree Deletion in DBMS Red-Black Tree Properties in DBMS Red-Black Tree Visualization in DBMS Redundancy in Database Management System Secondary Key in DBMS Structure of DBMS 2-Tier Architecture in DBMS Advantages and Disadvantages of Binary Search Tree Closure of Functional Dependency in DBMS Consistency in Database Management System Durability in Database Management System ER Diagram for Bank Management System in DBMS ER Diagram for College Management System in DBMS ER Diagram for Hotel Management System in DBMS ER Diagram for Online Shopping ER Diagram for Railway Reservation System ER Diagram for Student Management System in DBMS Isolation in DBMS Lossless Join and Dependency Preserving Decomposition in DBMS Non-Key Attributes in DBMS Data Security Requirements in DBMS DBMS functions and Components What is Homogeneous Database? DBMS Functions and Components Advantages and Disadvantages of Distributed Database Relational Database Schema in DBMS Relational Schema Transaction Processing in DBMS Discriminator in DBMS

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