MySQL Forums
Forum List  »  Newbie

Re: Finding broken links
Posted by: Felix Geerinckx
Date: May 09, 2005 10:34AM

Jos Elkink wrote:

> When I use foreign keys in a table and I want to check which ones are referring to entries that do
> not exist anymore, how could I do this?

You can use the InnoDB storage engine and enforce referential integrity from the start.

> How do I get exactly the opposite subset, only those where locations.id
> indeed does not exist? (So I can repair these inconsistencies in my database.)

You will need to use either a subquery or a LEFT OUTER JOIN.
See http://dev.mysql.com/doc/mysql/en/rewriting-subqueries.html for examples.

--
felix
Please use BBCode to format your messages in this forum.

Options: ReplyQuote


Subject
Written By
Posted
May 09, 2005 09:30AM
Re: Finding broken links
May 09, 2005 10:34AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.