The correct answer is D. All of above.
Referential integrity is a database constraint that ensures that the data in one table is consistent with the data in another table. It is implemented by creating a foreign key in the child table that references the primary key of the parent table. This prevents you from entering a value in the foreign key field of a child table if that value does not exist in the primary key of the parent table. It also prevents you from entering a value in the primary key field of child table if that value does not exist in the primary key of the parent table.
For example, let’s say you have a table called Customers
with a primary key of CustomerID
. You also have a table called Orders
with a foreign key of CustomerID
that references the CustomerID
column in the Customers
table. This means that you can only enter a value in the CustomerID
field of the Orders
table if that value exists in the CustomerID
field of the Customers
table.
Referential integrity is important because it helps to ensure the accuracy and consistency of your data. If you were able to enter a value in the foreign key field of a child table that did not exist in the primary key of the parent table, you would end up with orphaned data. This is data that is no longer related to any other data in the database. Orphaned data can be difficult to manage and can lead to errors.
Referential integrity is also important for performance. When you create a foreign key constraint, the database engine will automatically enforce that constraint. This means that the database engine will not allow you to enter data that violates the constraint. This can help to improve the performance of your database by preventing the database engine from having to search for data that does not exist.