0 · Recall Warm-up
Answer from memory first. Answers are in the Answer Vault at the bottom.
- What does ON DELETE CASCADE do? from Lesson 2.3.2
- What is the key of a weak entity type? from Lesson 1.2.3
- Why can a relation not hold {CS, EE} in one cell? from Lesson 2.1.1
1 · The Hook
You have an ER diagram; the DBMS wants tables. Converting one into the other is mechanical once you know a handful of rules, and GATE asks you to apply them quickly: "how many tables?", "what is the primary key of this table?". This lesson maps entity types and attributes; the next maps relationships.
2 · Predict First
STUDENT has key roll, a composite attribute name(first, last), a multivalued attribute phone and a derived attribute age. How many tables, and what columns, does STUDENT need?
Make a guess in your head. The answer opens Section 3.
3 · Core Concept
Predict First — the answer
Two tables. STUDENT(roll, first, last, dob, …): the composite is flattened into its parts and age is not stored. The multivalued phone gets its own table STUDENT_PHONE(roll, phone), because a cell can hold only one value.
Rule 1 · Strong entity type
Create a relation with all simple attributes. Choose one key as the primary key.
- Composite attribute: store only its simple components: name(first, last) → columns first, last.
- Derived attribute: usually not stored (compute when needed).
STUDENT(roll, first, last, dob, dept, cgpa)
Rule 2 · Weak entity type
Create a relation with the weak entity's simple attributes plus the owner's primary key as a foreign key. The primary key is owner's PK + partial key. The identifying relationship needs no table of its own. Use ON DELETE CASCADE on the FK (weak entities die with their owner).
ROOM(hname, room_no, capacity), hname → HOSTEL.hname
Rule 3 · Multivalued attribute
Create a new relation with the owner's primary key (foreign key) and the attribute. The primary key is both together (one student can have several phones, and two students could share a phone).
STUDENT_PHONE(roll, phone), roll → STUDENT.roll
A composite multivalued attribute {address(street, city, pin)} becomes ADDRESS(roll, street, city, pin) with a key made of roll plus enough parts to be unique (often all of them).
Count of tables so far
Every strong entity type: 1 table. Every weak entity type: 1 table. Every multivalued attribute: 1 extra table.
4 · Visual
One entity type with a multivalued attribute becomes two tables.
5 · Worked Examples
Example 1 Easy
Map COURSE(cid key, title, textbooks multivalued, credits).
Solution
COURSE(cid, title, credits) and COURSE_TEXTBOOK(cid, textbook) with cid → COURSE.cid. 2 tables.
Example 2 Medium
Map the weak entity DEPENDENT (partial key dname, attributes relation, dob) owned by EMPLOYEE(eid key, name).
Solution
EMPLOYEE(eid, name); DEPENDENT(eid, dname, relation, dob), eid → EMPLOYEE.eid ON DELETE CASCADE. The identifying relationship adds no table.
Example 3 GATE
An ER diagram has 3 strong entity types (one of which has 2 multivalued attributes), 1 weak entity type and no relationships other than the weak entity's identifying relationship. How many tables are needed at minimum?
Solution
3 (strong) + 1 (weak) + 2 (multivalued) = 6.
6 · GATE Traps
- Composite attributes give columns, not tables. Multivalued attributes give tables.
- The multivalued table's PK is (owner PK, value), not the owner PK alone.
- The weak entity's PK includes the owner's PK; its identifying relationship needs no table.
- Derived attributes are not stored.
7 · Memory Hook
"Composite spreads sideways, multivalued moves out, derived stays home (in the formula)."
8 · Connect the Dots
Lesson 2.4.1 handled entities and their attributes; next lesson handles the relationships between them: when a relationship becomes a foreign key, when it becomes its own table, and when two entity tables merge into one. That decides the GATE favourite "minimum number of tables".
9 · Self-Test
GATE format. Try every question before opening the vault.
Q1 · MCQ · 1 mark(s) — Multivalued
A multivalued attribute email of STUDENT(roll) is mapped to:
- (A) one column email in STUDENT
- (B) nothing; it is dropped
- (C) a table STUDENT_EMAIL(roll, email) with PK (roll, email)
- (D) a table STUDENT_EMAIL(roll, email) with PK roll
Q2 · MCQ · 1 mark(s) — Composite
A composite attribute address(street, city) of STUDENT is mapped to:
- (A) a single column holding both
- (B) columns street and city in STUDENT
- (C) a derived column
- (D) a separate table
Q3 · MCQ · 2 mark(s) — Weak entity
SECTION (partial key sec_no, attribute room) is weak with owner COURSE(cid). Its relation is:
- (A) SECTION(cid, sec_no, room) with PK cid
- (B) SECTION(sec_no, room) with PK sec_no
- (C) SECTION(cid, sec_no, room) with PK (cid, sec_no)
- (D) SECTION(sec_no, room) and a separate HAS(cid, sec_no) table
Q4 · NAT · 2 mark(s) — Counting tables
Entity types: STUDENT (strong, 1 multivalued attribute), COURSE (strong, 2 multivalued attributes), SECTION (weak, owner COURSE). Ignoring any relationships other than SECTION's identifying relationship, how many tables are needed at minimum?
Numerical answer: ________
Q5 · MSQ · 2 mark(s) — Mapping
Which are correct?
- (A) The identifying relationship of a weak entity needs its own table.
- (B) Derived attributes are normally not stored.
- (C) Each multivalued attribute adds one table.
- (D) The FK from a weak entity to its owner is usually ON DELETE CASCADE.
10 · Rule Card
- Strong entity → table of simple attributes; PK = chosen key; composite → components; derived → not stored.
- Weak entity → table with owner PK (FK, cascade) + own attributes; PK = owner PK + partial key; identifying relationship: no table.
- Multivalued attribute → table (owner PK FK, value); PK = both.
- Tables so far = strong + weak + multivalued attributes.
11 · Concept Ledger
Unlocked in this lesson. From here on, these terms may be used.
mapping strong entityflattening composite attributesmapping weak entity (owner PK + partial key)mapping multivalued attribute (separate table)
12 · Answer Vault
Reveal answers when you’re ready
Recall Warm-up
- Deletes every child row referring to the deleted parent, and follows the chain.
- The owner's key plus the partial key.
- Values must be atomic (1NF).
Self-Test
Q1 Answer: (C) · 1 mark(s)
Owner key plus value.
- (A) is wrong: Not atomic.
- (B) is wrong: No.
- (D) is wrong: A student has several emails.
Re-read: Lesson 2.4.1 — Mapping strong and weak entities, composite and multivalued attributes
Q2 Answer: (B) · 1 mark(s)
Flatten into simple components.
- (A) is wrong: Possible but loses the parts; standard mapping keeps components.
- (C) is wrong: No.
- (D) is wrong: Only multivalued attributes need tables.
Re-read: Lesson 2.4.1 — Mapping strong and weak entities, composite and multivalued attributes
Q3 Answer: (C) · 2 mark(s)
Owner PK + partial key.
- (A) is wrong: A course has several sections.
- (B) is wrong: sec_no repeats across courses.
- (D) is wrong: The identifying relationship needs no table.
Re-read: Lesson 2.4.1 — Mapping strong and weak entities, composite and multivalued attributes
Q4 Answer: 6 · 2 mark(s)
2 strong + 1 weak + 3 multivalued = 6.
Re-read: Lesson 2.4.1 — Mapping strong and weak entities, composite and multivalued attributes
Q5 Answer: (B) (C) (D) · 2 mark(s)
The identifying relationship is absorbed into the weak entity's table.
- (A) is wrong: No table needed.
Re-read: Lesson 2.4.1 — Mapping strong and weak entities, composite and multivalued attributes