Logical Modelling (ER Mapping)

Context: FIT2094_MOC · transform a conceptual ER model into a relational schema · entity→relation, key→PK, relationship→FK · database-type-dependent

Quick Revision

  • 🎯 Objective: transform a conceptual ER model to a relational schema âž” Step 2 of design.
  • 📦 Core Components: entity→relation âž” identifier→PK âž” relationship→FK.
  • ⚡ Key Constraint: relationships are not relations; database-type-dependent (vendor-free).

📝 Core

1. The Mapping

  • Step 2 âž” choose a database type (relational) and transform.
  • Rules âž” entity → relation; identifier → Primary Key; relationship → FK (PK/FK pair).

2. Three-Level Terminology

  • Conceptual âž” entity / attribute / instance / identifier / relationship.
  • Logical âž” relation / attribute / tuple / PK / FK.
  • Physical âž” table / column / row / PK / FK (vendor-dependent).

3. Preserved Characteristics

  • Unique relation name + PK âž” each relation.
  • Atomic attributes âž” one domain each, order immaterial.
  • Logical links âž” PK/FK pairs, no physical pointers.

⚖️ Core Decision Matrix

LevelDependenceOutput
conceptualmodel-independentER diagram
logicalDB type (vendor-free)relational schema
physicalvendor-specificschema file
relationship—FK, not a relation

When It Flips: bottom-up 3NF relations integrate with this top-down ER mapping (unify attribute names). The relationship line is kept even after the FK — it carries optionality developers need. Surrogate keys may now be introduced (Surrogate Key).

📊 Exam Execution Trace

Manual Execution Trace

Mapping CUSTOMER places ORDER:

Step / StateConceptualLogical
0 (Init)——
1CUSTOMER entityCUSTOMER relation, PK custno
2ORDER entityORDERS relation, PK orderno
3placesORDERS.custno FK

⚠️ Common Mistakes

  • đź’ˇ Relationships are not relations âž” realised by placing the parent’s PK as an FK in the child; only entities become relations.

đź§  Active Recall