Identifying vs Non-Identifying Relationship
Context: FIT2094_MOC Ā· whether a parentās key becomes part of the childās key Ā· solid vs dashed line Ā· identifying relationships create weak entities
Quick Revision
- šÆ Objective: does the parentās key become part of the childās key? ā solid = yes, dashed = no.
- š¦ Core Components: identifying (solid, weak child) vs non-identifying (dashed, own key).
- ā” Key Constraint: identifying ā¹ parent PK enters the childās composite PK; non-identifying ā¹ plain FK.
š Core
1. The Distinction
- Identifying ā Aās key is part of Bās key; B canāt be identified without A; solid line.
- Non-identifying ā Aās key is not part of Bās key; B has its own key; dashed line.
2. The Line-Style Rule
- Solid = identifying ā child inherits parentās key into its own (composite) key ā weak entity (
ROOMneedshotel_id). - Dashed = non-identifying ā both keep own keys (
DEPARTMENT/dept_no,EMPLOYEE/emp_no).
3. Weak-Entity Link
- Identifying āŗ weak child ā a weak entity is precisely one identified via an identifying relationship.
- Test ā ācan B be identified without Aās key?ā No ā¹ identifying.
āļø Core Implementation
š¹ Identifying vs non-identifying
Mermaid + schema
erDiagram HOTEL ||--|{ ROOM : contains DEPARTMENT ||..o{ EMPLOYEE : employsš” Common Mistake: Itās about the key, not mere association ā every relationship is an association; only an identifying one puts the parentās key inside the childās identifier (solid line).
āļø Core Decision Matrix
| Aspect | Identifying | Non-identifying |
|---|---|---|
| line | solid | dashed |
| parent key in child | part of PK | FK only |
| child | weak entity | own PK |
| example | HOTELāROOM | DEPARTMENTāEMPLOYEE |
When It Flips: identifying relationships and weak entities are two views of the same dependency. Logically: identifying ā¹ parent PK becomes part of the child's composite Primary Key; non-identifying ā¹ parent PK is a plain Foreign Key. Line style is independent of the cardinality symbols.
š Exam Execution Trace
Applied Exercise
Problem: Room 601 can exist in many hotels. Is HOTELāROOM identifying? Give the schema. Derivation Proof / Hand-Calculation Walkthrough:
Final Extracted Output: identifying; ROOMās composite PK includes HOTELās hotel_id (weak entity).
š§ Active Recall
Define identifying vs non-identifying relationships and their Crow's Foot line styles.
- Hint: Key inheritance.
Answer
- Short answer: Identifying = parentās key part of childās key (solid, weak child); non-identifying = childās own key (dashed).
- Why: ROOM vs EMPLOYEE ā ROOM needs
hotel_id; EMPLOYEE keepsemp_no.
How does the distinction translate to the relational logical model?
- Hint: PK vs FK placement.
Answer
- Short answer: Identifying ā¹ parent PK becomes part of the childās composite PK; non-identifying ā¹ parent PK is only an FK.
- Why: Line predicts placement ā solid ā inside PK, dashed ā FK only.