"A good ERD with bad tables is still a bad database."
Where Most People Mess Up
In this session we will take one small ERD (students and courses), turn it into concrete tables, and pick safe keys step by step.
Conceptual model
Ideas on paper
Physical implementation
Reality in code
Week 1 lived in ideas. Week 2 lives in structure. In this session we only walk from ERD (conceptual) to tables (logical).
ERD — entities, relationships, attributes (ideas)
Tables, keys, columns, data types (structure)
Storage, indexes, partitions, performance (implementation)
Each level answers: What? → How? → Where?
Most entities become tables... but not always. Relationships sometimes become tables. Example: in an ERD you draw "STUDENT enrolls in COURSE" as one relationship line, but in tables that relationship becomes its own ENROLLMENT table.
Rectangle on paper
Not automatic!
Correct! Many-to-many relationships become junction tables.
Disciplined translation. Every element has a destination. We will keep one concrete example in mind: a single STUDENT box in the ERD becoming a real STUDENT table.
Golden Rule: Be slow. Be deliberate. Every table must earn its existence.
The most expensive mistake in database design.
Can distinguish rows
but may change
Never changes
has no meaning
Identity. Immutable. Meaningless.
Could be PK, but we chose one
Unique constraint, not identity
"A key that can change
is not a key."
Marriage, correction, translation
Providers, jobs, preferences
Moving, restructuring
But student_id = S104729 is forever.
Given this ERD fragment, what becomes a table?
Click to select. The N:M relationship becomes its own table.
Is this a strong entity or a relationship in disguise?
Does my PK never change and have no business meaning?
Are these atomic? No repeating groups?
Do I need a junction table for N:M?
"ERD is the map. Tables are the territory. Never confuse the two."