Missing relationships occur when a record in one table does not have a corresponding related record in another table.
Missing relationships can indicate incomplete data, data-quality issues, migration problems, or legitimate business situations.
Find customers who do not have any orders.
SELECT
c.CustomerID,
c.CustomerName
FROM Customers c
LEFT JOIN Orders o
ON c.CustomerID = o.CustomerID
WHERE o.CustomerID IS NULL;
Used in customer analysis, reconciliation, data-quality checks, and compliance reporting.
- LEFT JOIN can identify missing relationships.
- NULL values can indicate no matching record.
- Missing relationships are not always errors.
- Business rules should determine whether missing data is acceptable.
- NOT EXISTS can also be used.
How can you find customers without orders?
Use a LEFT JOIN from Customers to Orders and filter where the related Order key is NULL.
Are missing relationships always data errors?
No. Some relationships may be optional or may legitimately not exist.