Page 238 - IT_V1.0_Class10
P. 238
They restrict invalid data entry in referenced fields and ensure updates in the master table are automatically
reflected in related tables.
Relationships save time by eliminating the need to re-enter data across connected tables, reduce
data-entry errors, and facilitate summarising data from related tables.
Referential Integrity
Referential integrity is applied in databases to maintain the accuracy and consistency of data in relationships
between tables. When data is linked between two or more tables with the help of primary key and foreign
key constraints, this rule helps to:
Referential integrity ensures that you cannot add records to a child table (which contains the foreign key)
unless there is a corresponding parent record (which contains the primary key). This is enforced by the
foreign key constraint.
Changing a primary key value in the parent table is generally not allowed as it would violate referential
integrity. This is because foreign keys in child tables reference the primary key value.
Referential integrity typically prevents deleting records from the primary key table if there are matching
records in the child table(s), unless cascading delete is specified.
Creating and Editing Relationships between Tables
Consider a database of your class in which the student details and their marks details are stored in two
separate Tables, namely, Student and Student_Marks. Establish a relationship between two tables and add a
few records in both the tables. Delete a record from the Student table and see if the same gets deleted from
the Student_Marks table or not.
A relationship refers to an association or connection between fields of two or more tables. When you relate
or connect two tables, there is a need to enter the same data in separate tables.
The steps to create a relationship between tables are as follows:
Step 1: Click on the Tools menu in the Menu bar.
Step 2: Select the Relationships option from the drop-down menu to set up relationships.
The Relation Design window appears with the Add Tables dialog box.
1
2
236 Information Technology Play (Ver 1.0)-X

