Question

In: Computer Science

What would you do if you encountered a database that violated referential integrity? How would you...

What would you do if you encountered a database that violated referential integrity? How would you address the problem? When forming your answer be sure to include at least one of the three main types of referential actions (cascade, restrict, set null).

Solutions

Expert Solution

Q What would you do if you encountered a database that violated referential integrity? How would you address the problem? When forming your answer be sure to include at least one of the three main types of referential actions (cascade, restrict, set null).

Ans: Firstly let's take an overview about the referential integrity.The referential integrity is basically a database concept that are used to maintain and build a logical relationships  between the tables to avoid the logical corruption of data.This concept is very important in the RDBMS.The  referential integrity concept is basically made up of the combination of the foreign key and the primary key.The main use of the referential integrity is that it does not allow to add the table which contain the foreign key unless if the reference table contain the corresponding primary key.

So, we see above that the how much referential integrity is important to maintain in the database.The following are the causes of violation of referential integrity in the databases:

  • Insertion to a referencing relation:It allow to insert only those value of the referencing attribute that are already present in the value of the referenced attribute.So, inserting the value in the referencing attribute that are not present in the  value of the referenced attribute that will violate the referential integrity constraint.
  • Deletion from a referenced relation: This is the another reason for the violation of the referential integrity.When the referencing attribute uses the value of the referenced attribute then it not allowed to delete the row from the referenced relation.This type of deletion violates the the referential integrity constraint.
  • Updation in a Referenced Relation: This is not correct way or we can say allow to update a row of the referenced relation when the  referencing attribute uses the value of  referenced attribute of that row.

Handling the Violation-To handle the violation we can perform the following method:

  1. This method is basically called the On Update Cascade.In this method the simultaneous updation of those tuples of the referencing relation are done that referencing attribute that uses the referenced attribute value that are being updated.
  2. In this method the deleting and aborting the request are involved that  request for the updation of the referenced relation when the value is used by the referencing relation.
  3. This is the last method in which the setting of the value are being updated   in the referenced relation to NULL or some other value that  referencing the relation when the the referencing attribute uses that value.

Cascade referential integrity: Cascading referential integrity  constraints is basically a foreign key constraints that tells the SQL Server to perform certain task when the  primary key field are deleted or updated in the primary key-foreign key relationship .In the cascade referential integrity it basically uses the foreign key constraints that tells the SQL sever to perform certain task.To specify the action that are taking places in the referenced table or referencing table ue use the  CASCADE or RESTRICT to  specify the actions.

THANKS , i think this will give you a better intuition about your question. If you have any doubt feel free to ask in the comment section.


Related Solutions

Assuming Database is not providing Referential Integrity Constraints support i-e Primary key, foreign key and Unique...
Assuming Database is not providing Referential Integrity Constraints support i-e Primary key, foreign key and Unique key, your task is to design a database engine with your own built in Referential integrity rules implementation and you need that only one database connection is maintained which an application should access. Recommend proper design pattern used for the stated problem. Give reasons for selecting that pattern, create complete class diagram for the solution. The class diagram should also show the methods of...
QUESTION 1 a. What are referential integrity constraints? Please explain with an example. b. Explain with...
QUESTION 1 a. What are referential integrity constraints? Please explain with an example. b. Explain with an example the GROUP BY/HAVING clause
identify at least four examples of how the integrity of the medical record can be violated
identify at least four examples of how the integrity of the medical record can be violated
identify at least four examples of how the integrity of the medical record can be violated
identify at least four examples of how the integrity of the medical record can be violated
Explain what academic integrity is, and explain how you are prepared to meet the academic integrity...
Explain what academic integrity is, and explain how you are prepared to meet the academic integrity standards at your nursing school
1- How can database systems improve data quality and data integrity? 2- Discuss database constraints: Primary...
1- How can database systems improve data quality and data integrity? 2- Discuss database constraints: Primary key, check, and referential integrity constraints? Give an example for each.
how do you access the icf crosswalk database?
how do you access the icf crosswalk database?
I would like you to think and write about how you might define integrity in the...
I would like you to think and write about how you might define integrity in the dimension of character leadership for yourself (500 words)
How would you handle this situation? What would you advise Orlando to do in this meeting?...
How would you handle this situation? What would you advise Orlando to do in this meeting? What would you tell his manager, if anything? Are there any systemic changes you could think of that may help prevent instances like these from happening in the future? The annual reviews have just been completed, and you heard from Orlando Nicholson, an employee who had been with the firm for two years. Orlando has a cordial but distant relationship with his manager. He...
How do feel you would respond if that sensation happened to you suddenly? What would you...
How do feel you would respond if that sensation happened to you suddenly? What would you think was happening?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT