We often refer to the tables in a relationship as the primary-key table and the foreign-key table. (Notice that, though both tables have primary keys, the only primary key that plays a role in the relationship is the primary key on the one-side of the relationship. This relationship is implemented by creating a foreign key (CourseID) in the table on the many-side of the relationship (the Section table) that references the primary key (CourseID) in the table on the one-side of the relationship (the Course table). The Course and Section tables are related to each other in a one-to-many relationship (for each course in the Course table, there can be many sections in the Section table and for each section in the Section table, there can be only one course in the Course table). Let’s take the example shown in the database design article referenced in the paragraph above. The Referential Integrity constraint requires that values in a foreign key column must either be present in the primary key that is referenced by the foreign key or they must be null. (For a primer on relationships, download this article.) Referential Integrity is a constraint in the database that enforces the relationship between two tables. Relationships in a database are implemented with foreign keys and primary keys. Which method is used may be determined by a referential integrity constraint defined in a data dictionary.Ever wonder why there are only two options under the INSERT and UPDATE Specification of a foreign key? Why is there no Insert Rule? And to which table in the relationship do these rules apply? Some relational database management systems can enforce referential integrity, normally either by deleting the foreign key rows as well to maintain integrity, or by returning an error and not performing the delete. For instance, deleting a record that contains a value referred to by a foreign key in another table would break referential integrity. In other words, when a foreign key value is used it must reference a valid, existing primary key in the parent table. Referential integrity is a property of data which, when satisfied, requires every value of one attribute of a relation to exist as a value of another attribute in a different relation.įor referential integrity to hold in a relational database, any field in a table that is declared a foreign key can contain either a null value, or only values from a parent table's primary key or a candidate key. ![]() A lack of referential integrity in a database can lead relational databases to return incomplete data, usually with no indication of an error.įreebase Rate this definition: 3.0 / 1 vote In simple terms, 'referential integrity' guarantees that the target 'referred' to will be found. The adjective 'referential' describes the action that a foreign key performs, 'referring' to a linked column in another table. Which method is used may be determined by a referential integrity constraint defined in a data dictionary. ![]() Some relational database management systems (RDBMS) can enforce referential integrity, normally either by deleting the foreign key rows as well to maintain integrity, or by returning an error and not performing the delete. ![]() In the context of relational databases, it requires that if a value of one attribute (column) of a relation (table) references a value of another attribute (either in the same or a different relation), then the referenced value must exist.For referential integrity to hold in a relational database, any column in a base table that is declared a foreign key can only contain either null values or values from a parent table's primary key or a candidate key. Referential integrity is a property of data stating that all its references are valid. Wikipedia Rate this definition: 0.0 / 0 votes
0 Comments
Leave a Reply. |