devxlogo

Establish Referential Integrity

Establish Referential Integrity

Question:
How do you Establish Referential Integrity between 2 tables so that when a ticket is deleted from the TICKETS table all associated information in the customer5 table will be deleted?

Answer:
Forgive me if I missed the boat, but it seems that you want to delete the parent records on deletion of a child record. I think this is unusual, in that the problem is usually stated as retaining history in the absence of parents. If this is indeed what you intend, you can find the ticket.customer_id in the deleted table and use it to delete the customer record with that id as its primary key, but I wouldn’t recommend doing that.

See also  How College Students Can Shape the Future of Tech Responsibility
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist