New Page 1
Welcome to basicsofcomputer.com
 

Share This Free Knowledge With Your Friends:

Home » Logical Database Design and Relational Data Model » Data Integrity Rules

Data Integrity Rules:

Definition and explanation:

Data integrity refers to the correctness and consistency of data. It is another form of database protection or security. Security involves protecting the data from unauthorized operations, while integrity is concerned with the quality of data itself. The data integrity plays very important role in RDBMS, in which multiple users access the data from database.

Integrity is usually expressed in terms of certain constraints, These are the consistency rules that can be applied to database so that the correct data can be entered into database. The constraints may be applied to individual data items within a single record or they may be applied to relationships between records. Integrity rules/constraints check the data that is entered or modified into the database, the examples of integrity constraints are:

  • 'Issue Date' of a book in a library system cannot be later than the corresponding 'Return Date' of a book.
  • Maximum obtained marks in a subject cannot exceed 100 and less than 0.
  • The value of attribute "Gender" for each record of student table must be "Male" or "Female".
  • The records of a table must be unique.

Important data integrity rules are:

(i) Entity integrity

(ii) Domain integrity

(iii) Referential integrity

(i) Entity Integrity:

The entity integrity constraint states that in a relation no primary key value can have a null value. Entity, integrity constraint is also referred to as uniqueness constraint. By definition, a primary key is used to identify tuples uniquely. If two or more tuples have null values in the primary key attribute, then you can not identify tuples uniquely.

(ii) Domain integrity:

A domain represents a set of values that can be assigned to an attribute. Domain integrity constraint is specified on the column (attribute) of a relation, so that correct values can be entered in the column for each record.

You can specify domain for an attribute into DBMS or into application code. For example, in Ms-Access, you can specify the. value of 'Marks' attribute of "Student" table which must be greater than 0 and less than or equal to 200 as shown in figure below.

In the above figure, you have applied the domain constraint to the 'Marks' attribute. In the "Field Properties" section, the property labeled with "Validation Rule" is used to specify the domain constraint. It is specified by using the expression 0 >= 200 AND <= 200 as shown above. You can also specify the text for message in the "Validation Text" field, which will be displayed if user does not follow the domain rule. Suppose you enter the text "Invalid marks of student", the message1 displayed is shown in figure below.

(iii) Referential integrity:

The referential integrity constraint is specified between two relations and is used to maintain the consistency among tuples of two relations. Referential integrity is applied on foreign keys.

Referential integrity states that if a foreign key exists in a relation, then the foreign key value must match the primary key value of some tuple in its home relation (parent relation) or the foreign key value must be completely null.

Referential integrity ensures that the relationships between records in related tables remain consistent. For example, if the relationship between "Student" table and "Marks" table is created then the DBMS will not allow you to delete record from the ''Student" table if there is a record related to that student in the "Marks" table.

In 'Student' table, the 'Roll-No' attribute is used as primary key. Similarly, the 'Roll-No' attribute is used as foreign key in 'Marks' table. The referential integrity is implemented by primary key and foreign key relationship. The records in 'Student' table cannot be deleted, if the related records exist in 'Marks' table.

Relevant Articles:

Logical Database Design
Relational Data Model
Relation in database (DBMS)
Data Integrity Rules
Relational Data Manipulation Languages
Relational Algebra Operators in DBMS
Codd's 12 Rules For the Relational Model
 
New Page 1

Basic Computer Science

   
» The Age of Information

» Types of Computer and Digital Age

» Input and Output Devices

» Storage Devices Of Computer

» Central Processing Unit

» Software: The Power Behind The Power

» Data Communication and Computer Networks

» The Nature Of Information

» The System Theory

» Transaction Processing System (TPS) and Management Information System (MIS)

» Decision Support System (DSS) and Executive Support System (ESS)

» Expert System (ES) and Office Information System (OIS)

 

Operating Systems

   
» Introduction to Operating System

» Introduction to Process Management

» Threads and CPU Scheduling

» Process Synchronization in Operating System

» Deadlocks

» Memory Management in Operating System

» Virtual Memory in Operating System

» File System Management in Operating System

» I/O and Device Management

» Security

» Linux Operating System

 

Database Management System

   
» Introduction to Database Systems

» Database System Architecture

» Database Administration and Database Development Process

» The Entity-Relationship Model

» Semantic Object Model

» Logical Database Design and Relational Data Model

» Normalization in Database

» Transformation of E-R Model into Relational Data Model

» Representing Semantic Object Model and Types of Semantic Object Model

» Physical Database Design

» Introduction to Structured Query Language (SQL)

» Implementation of Relational Database and Database Application Design

» Client Server Database Systems & Open Database Connectivity (ODBC)

 

Questions and Answers

   
» Basics of Information Technology

» Computer Architecture

» Data Communication

» Information Networks

» Fundamentals of the Internet

» Application and Uses of Computer

» Security, Copyright and The Law

» Windows Operating Systems

» Spreadsheet Software

» Process Management in CPU

» CPU Scheduling

» Process Synchronization

» Deadlocks

» Memory Management

» Database Systems

» Database System Architecture

» Database Administration and Database Development Process
 
 
New Page 1
 

Home                Dictionary                 Contact us                   About us                    Privacy policy                  Link to us                   Advertise

Copy right ©  2012