Is there some nice automated way/program for cleaning up my database? I have a couple of tables with relations that in some cases just point at records that doesn’t exist.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Sounds like you are missing some Foreign Key Constraints.
Depending on the
ON DELETEoption, orphaned records will be deleted together with the referenced records, referencing columns set toNULL, or deleting will be rejected.You will have to delete those existing entries manually using a query like this, before creating your constraints: