🚧 Under construction — VoTechWorks is being built. A free tech program — complimentary, as our commitment to get America working.
voTechWorksGrade 13 · a vocational technology learning center, by urbanicity
newSchoolWorks.com › VoTechWorks › Technology & Design › Data Management / Database Administration › Relational Design & Normalization › Lesson 3
TEC-DATA86-02 · Lesson 3 · 10 clock hours · demo

Mapping ERDs to Relational Schemas

Objective. Students will convert a completed ERD into a relational schema by applying the standard mapping rules for all relationship types, including resolution of many-to-many relationships into junction tables.

⚠ Pending professional review

This lesson, its worked examples and its practice questions has not yet been verified by an industry-certified professional or by a certification or approval body. It is a study draft and may contain errors. Do not use it as instructions for work on a job site or on live equipment. Always follow your instructor, your supervising professional, and current official references and regulations.

VoTechWorks program approval and accreditation are still in progress. Credentials are issued only by the certifying bodies named in each program, after their own exams.

From ERD to Relational Schema

An entity-relationship diagram (ERD) is a planning tool. A relational schema is the blueprint that a database engine can actually implement. Mapping means translating every entity, attribute, and relationship from your ERD into tables, columns, and keys using a consistent set of rules. Mastering this translation is one of the most tested skills on the DAMA CDMP Associate, Oracle DBA CA, PostgreSQL CE, and Microsoft DP-300 exams.

Rule 1 — One Entity Becomes One Table

Every strong (regular) entity in your ERD becomes a table. The entity name becomes the table name. Each single-valued attribute becomes a column. The entity's primary key (PK) attribute becomes the primary key of the table.

Example: An entity Book with attributes `book_id`, `title`, and `publication_year` maps directly to:

```

Book(book_id PK, title, publication_year)

```

Weak entities also become tables, but their primary key is a composite of their own partial key plus the primary key of the identifying (owner) entity, which becomes a foreign key.

Rule 2 — One-to-Many Relationships Use a Foreign Key

In a one-to-many (1:M) relationship, the table on the many side receives a new column: a foreign key (FK) that references the primary key of the one side. No separate relationship table is needed.

Example: One Branch has many Members. The `branch_id` FK is added to the Member table:

```

Branch(branch_id PK, branch_name, address)

Member(member_id PK, full_name, branch_id FK → Branch.branch_id)

```

The foreign key enforces referential integrity — you cannot insert a member with a `branch_id` that does not exist in Branch.

Rule 3 — Many-to-Many Relationships Require a Junction Table

A many-to-many (M:N) relationship cannot be stored directly in either participating table without violating normalization rules. The solution is a junction table (also called an associative table, bridge table, or linking table). The junction table holds at minimum the primary keys of both sides as foreign keys, and those two columns together form the composite primary key of the junction table. Additional attributes that belong to the relationship itself are also placed here.

Example: A Member can borrow many Books, and each Book can be borrowed by many Members. The relationship Loan carries a `loan_date` attribute:

```

Loan(member_id PK/FK → Member.member_id,

book_id PK/FK → Book.book_id,

loan_date)

```

This junction table eliminates the M:N relationship and replaces it with two 1:M relationships.

Rule 4 — One-to-One Relationships

A one-to-one (1:1) relationship is handled by placing the FK in either table, but it is usually placed in the table that represents the optional or less-frequent participant. A `UNIQUE` constraint on the FK column enforces the one-to-one nature.

Rule 5 — Multivalued Attributes Become Separate Tables

If an entity has a multivalued attribute (for example, a Member who may have several phone numbers), that attribute becomes a new table containing the owning entity's PK as a FK, and the attribute itself as a column. The two columns together typically form the composite PK.

```

MemberPhone(member_id PK/FK → Member.member_id,

phone_number PK)

```

Standard SQL-Like Schema Notation

When you write up a schema, use the notation your team or exam expects. A widely accepted convention is:

```

table_name(col1 PK, col2, col3 FK → other_table.col_name)

```

Maintaining Data Integrity Through the Mapping

Every mapping decision you make has a direct effect on data integrity:

Always cross-check your finished schema against the original ERD. Every relationship arrow in the ERD must appear as a FK or junction table in the schema, and every entity must appear as a table.

Accuracy and Version Control

In a professional or classroom setting, treat your schema diagram as a controlled document. Date it, name it, and store it alongside the ERD it was derived from. When the ERD changes — and it will — the schema must be updated and both documents kept in sync. This habit is fundamental to database administration practice and is tested conceptually on all four credentials targeted by this program.

Key terms8

Relational schemaA formal description of a database's tables, columns, primary keys, and foreign keys derived by applying mapping rules to an ERD.
Junction tableA table created to resolve a many-to-many relationship; it holds foreign keys to both participating tables and any attributes of the relationship itself.
Foreign key (FK)A column (or set of columns) in one table that references the primary key of another table, enforcing referential integrity between them.
Referential integrityA database constraint ensuring that every foreign key value in a child table matches an existing primary key value in the parent table.
Composite primary keyA primary key made up of two or more columns whose combined values uniquely identify each row; common in junction tables.
Multivalued attributeAn ERD attribute that can hold more than one value for a single entity instance; mapped to a separate table to maintain First Normal Form.
Weak entityAn entity that cannot be uniquely identified by its own attributes alone and depends on an identifying (owner) entity for its primary key.
Mapping rulesThe standard set of procedures — one entity to one table, 1:M to FK, M:N to junction table, multivalued attribute to separate table — used to convert an ERD into a relational schema.
In class: Step-by-step guided mapping: instructor converts the library ERD from Lesson 2 into a schema diagram on the board, narrating each mapping rule (one entity → one table, many-to-many → junction table, one-to-many → foreign key in the 'many' table). · Mapping worksheet: students individually map the retail-store ERD they built in Lesson 2 into a schema, writing out each table name, column names, and underlined/highlighted key columns on a structured worksheet. · Schema notation exercise: students rewrite their worksheet schemas using standard SQL-like notation (table_name(col1 PK, col2, col3 FK → other_table.col)) and peer-check notation correctness.
Materials: Whiteboard, mapping rules handout, structured mapping worksheet, retail-store ERD from Lesson 2, SQL notation reference
Check: Instructor checks mapping worksheet and notation; all relationship types from the ERD must be correctly represented in the schema. Pass: correct mapping of at least 9 of 10 relationships on a schema-mapping quiz.

Practice check8

Answer each question, then check it. Nothing is recorded; this is your own practice.

Data Modeling and Design
1. When mapping a many-to-many relationship from an ERD to a relational schema, what must you create?
Database Design
2. A retail store ERD shows that one Department contains many Products. Applying the standard one-to-many mapping rule, where does the foreign key go?
Database Design
3. Which schema notation line correctly represents a foreign key relationship?
Data Modeling and Design
4. An ERD shows that a Member entity has a multivalued attribute PhoneNumber. What is the correct way to map this to a relational schema?
Data Modeling and Design
5. A junction table resolving a Student–Course many-to-many relationship also needs to store the grade a student earned. Where should the grade attribute be placed?
Database Design
6. What constraint is typically added to a foreign key column in a one-to-one relationship to enforce that cardinality?
Database Administration
7. After completing a schema mapping, a student realizes one ERD relationship arrow has no corresponding FK or junction table in the schema. What is the most likely consequence if this is left uncorrected in the actual database?
Data Modeling and Design
8. A weak entity OrderLine depends on the strong entity Order for identification. In the mapped schema, which columns form the primary key of the OrderLine table?
Record this lesson on my transcript. Sign in with your key and enrollment email to record lessons (enroll free if you have no key). This page stays open to read and practise.