Answer: The Foreign key value which exist in child table, without existing in primary key column in the parent table is known as an Orphan.
Example for finding an Orphan:
An orphan record exists when there is a Contact2 record but NOT a Contact1 record
SELECT * FROM Contact2 WHERE AccountNo NOT IN (SELECT AccountNo from Contact1)
Asked In: Many Interviews |
Alert Moderator