© 2026 schoolict.net (Ruwan Mangala Suraweera)
8.6 Transforming ER Diagrams to a Logical SchemaER රූප සටහන් තාර්කික ක්රමානුරූපයට පරිවර්තනය
Grade 13 A/L ICT · Lesson 813 ශ්රේණිය A/L ICT · පාඩම 8
In this videoමේ වීඩියෝවේ
- Entity → table; identifier → primary key.ආයතනය → වගුව; හඳුනාගැනීම → PK.
- Attribute → column; composite → parts.උපලක්ෂණය → තීරුව; සංයුක්ත → කොටස්.
- 1:N → foreign key in the many side.1:N → “බොහෝ” පැත්තේ FK.
- M:N → linking table with a composite key.M:N → සංයුක්ත යතුර සහිත සම්බන්ධක වගුව.
- Multi-valued → separate table.බහු අගය → වෙනම වගුව.
Notesසටහන්
Syllabus 8.6. After drawing an ER diagram we transform it into tables. Entities become relations, attributes become columns, identifiers become primary keys, and relationships become foreign keys or new linking tables depending on cardinality.විෂය නිර්දේශය 8.6. ER රූපයක් ඇඳීමෙන් පසු එය වගු බවට පරිවර්තනය කරමු. ආයතන සම්බන්ධතා වේ, උපලක්ෂණ තීරු වේ, හඳුනාගැනීම් ප්රාථමික යතුරු වේ, සම්බන්ධතා ගණනීයතාව අනුව විදේශීය යතුරු හෝ නව සම්බන්ධක වගු වේ.
1. Entity and attribute transformation1. ආයතන සහ උපලක්ෂණ පරිවර්තනය
- Each strong entity → one table; the identifier → primary key.සෑම ප්රබල ආයතනයක්ම → එක් වගුවක්; හඳුනාගැනීම → ප්රාථමික යතුර.
- Simple attributes → columns; composite → one column per part (Street, City).සරල උපලක්ෂණ → තීරු; සංයුක්ත → කොටසකට තීරුවක් (Street, City).
- Multi-valued → a new table with the owner key, e.g. StudentPhone(StudentID, Phone).බහු අගය → හිමිකරු යතුර සමඟ නව වගුවක්, උදා: StudentPhone(StudentID, Phone).
- Derived attributes are usually not stored (calculate Age when needed).ව්යුත්පන්න උපලක්ෂණ සාමාන්යයෙන් ගබඩා නොකරයි (අවශ්ය විට Age ගණනය).
2. Relationship transformation2. සම්බන්ධතා පරිවර්තනය
| Cardinalityගණනීයතාව | Ruleනීතිය | Exampleඋදාහරණය |
|---|---|---|
| 1:11:1 | Put the PK of one side as a FK (often UNIQUE) in the otherඑක් පැත්තක PK අනෙකේ FK ලෙස (බොහෝ විට UNIQUE) | School(…, PrincipalID)School(…, PrincipalID) |
| 1:N1:N | Put the PK of the “1” side as a FK in the “N” side“1” පැත්තේ PK “N” පැත්තේ FK ලෙස | Student(…, ClassID)Student(…, ClassID) |
| M:NM:N | Create a new table with both PKs as a composite PKPK දෙකම සංයුක්ත PK ලෙස ඇති නව වගුවක් | Student_Subject(StudentID, SubjectCode)Student_Subject(StudentID, SubjectCode) |
A program applied the rules: 4 tables – Student(StudentID, Name, ClassID); Subject(SubjectCode, Title); Class(ClassID, ClassName); Student_Subject(StudentID, SubjectCode). Student gets the foreign key ClassID; the M:N becomes Student_Subject with a composite key.වැඩසටහනක් නීති යෙදුවේය: වගු 4 – Student(StudentID, Name, ClassID); Subject(SubjectCode, Title); Class(ClassID, ClassName); Student_Subject(StudentID, SubjectCode). Student හට විදේශීය යතුර ClassID ලැබේ; M:N සංයුක්ත යතුරක් සහිත Student_Subject වේ.
📝 Resulting logical schemaලැබෙන තාර්කික ක්රමානුරූපය
Student(StudentID, Name, ClassID) Subject(SubjectCode, Title) Class(ClassID, ClassName) Student_Subject(StudentID, SubjectCode)
Attributes of an M:N relationship (e.g. DateBorrowed in the library) go into the linking table: Borrow(MemberNo, ISBN, DateBorrowed).M:N සම්බන්ධතාවක උපලක්ෂණ (උදා: DateBorrowed) සම්බන්ධක වගුවට යයි: Borrow(MemberNo, ISBN, DateBorrowed).
Key Wordsප්රධාන පද
Sample Q&Aආදර්ශ ප්රශ්න සහ පිළිතුරු
1How is an entity transformed?ආයතනයක් පරිවර්තනය?
2How is a 1:N relationship transformed?1:N පරිවර්තනය?
3How is an M:N relationship transformed?M:N පරිවර්තනය?
4How many tables for the school ER?පාසල් ER වගු ගණන?
5Where does DateBorrowed go?DateBorrowed යන්නේ?
6How is a multi-valued attribute stored?බහු අගය ගබඩා කරන්නේ?
MCQබහුවරණ ප්රශ්න
Choose the correct answer for each question.සෑම ප්රශ්නයකටම නිවැරදි පිළිතුර තෝරන්න.
1Each entity in an ER diagram becomes aආයතනය
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: B
Table.වගුව.
2An entity identifier becomes theහඳුනාගැනීම
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: E
PK.PK.
3For Class 1:N Student, the foreign key goes in1:N
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: D
Many side.“බොහෝ” පැත්ත.
4An M:N relationship becomesM:N
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: C
Linking table.සම්බන්ධක වගුව.
5The school ER (3 entities, one 1:N, one M:N) givesවගු ගණන
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: A
3 + 1.3 + 1.
6The key of Student_Subject isStudent_Subject
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: C
Composite.සංයුක්ත.
7A multi-valued attribute such as Phone becomesPhone
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: A
Separate table.වෙනම වගුව.
8A composite attribute Address becomesAddress
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: E
Parts.කොටස්.
9Which term means: “Turning each entity into a table”?“සෑම ආයතනයක්ම වගුවක් බවට හැරවීම” යන්නෙන් අදහස් වන පදය කුමක්ද?
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: D
Entity transformation – Turning each entity into a table.ආයතන පරිවර්තනය – සෑම ආයතනයක්ම වගුවක් බවට හැරවීම.
10Which term means: “Turning attributes into columns of a table”?“උපලක්ෂණ වගු තීරු බවට හැරවීම” යන්නෙන් අදහස් වන පදය කුමක්ද?
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: E
Attribute transformation – Turning attributes into columns of a table.උපලක්ෂණ පරිවර්තනය – උපලක්ෂණ වගු තීරු බවට හැරවීම.
11Which term means: “Turning relationships into foreign keys or linking tables”?“සම්බන්ධතා FK හෝ සම්බන්ධක වගු බවට හැරවීම” යන්නෙන් අදහස් වන පදය කුමක්ද?
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: B
Relationship transformation – Turning relationships into foreign keys or linking tables.සම්බන්ධතා පරිවර්තනය – සම්බන්ධතා FK හෝ සම්බන්ධක වගු බවට හැරවීම.
12Which term means: “Table created for an M:N relationship holding both keys”?“යතුරු දෙකම ඇති M:N සඳහා සාදන වගුව” යන්නෙන් අදහස් වන පදය කුමක්ද?
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: A
Linking table – Table created for an M:N relationship holding both keys.සම්බන්ධක වගුව – යතුරු දෙකම ඇති M:N සඳහා සාදන වගුව.
13Which term means: “The key of the one side goes into the many side”?““එක” පැත්තේ යතුර “බොහෝ” පැත්තට යයි” යන්නෙන් අදහස් වන පදය කුමක්ද?
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: B
One-to-many rule – The key of the one side goes into the many side.එකට-බොහෝ නීතිය – “එක” පැත්තේ යතුර “බොහෝ” පැත්තට යයි.
14Which term means: “A new table with both primary keys is created”?“ප්රාථමික යතුරු දෙකම සහිත නව වගුවක් සාදයි” යන්නෙන් අදහස් වන පදය කුමක්ද?
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: C
Many-to-many rule – A new table with both primary keys is created.බොහෝ-ට-බොහෝ නීතිය – ප්රාථමික යතුරු දෙකම සහිත නව වගුවක් සාදයි.
15Which term means: “The key of one side is placed as a unique foreign key in the other”?“එක් පැත්තක යතුර අනෙකේ අනන්ය FK ලෙස තබයි” යන්නෙන් අදහස් වන පදය කුමක්ද?
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: D
One-to-one rule – The key of one side is placed as a unique foreign key in the other.එකට-එක නීතිය – එක් පැත්තක යතුර අනෙකේ අනන්ය FK ලෙස තබයි.
16Which term means: “Primary key made from two or more columns”?“තීරු දෙකක් හෝ වැඩියෙන් සෑදූ ප්රාථමික යතුර” යන්නෙන් අදහස් වන පදය කුමක්ද?
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: A
Composite primary key – Primary key made from two or more columns.සංයුක්ත ප්රාථමික යතුර – තීරු දෙකක් හෝ වැඩියෙන් සෑදූ ප්රාථමික යතුර.
17Which term means: “Entity with its own identifier”?“තමන්ගේම හඳුනාගැනීමක් ඇති ආයතනය” යන්නෙන් අදහස් වන පදය කුමක්ද?
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: C
Strong entity – Entity with its own identifier.ප්රබල ආයතනය – තමන්ගේම හඳුනාගැනීමක් ඇති ආයතනය.
18Which term means: “Entity that depends on another for its identity”?“හඳුනාගැනීම සඳහා අනෙකක් මත රඳා පවතින ආයතනය” යන්නෙන් අදහස් වන පදය කුමක්ද?
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: B
Weak entity – Entity that depends on another for its identity.දුර්වල ආයතනය – හඳුනාගැනීම සඳහා අනෙකක් මත රඳා පවතින ආයතනය.
19Which term means: “Separate table that stores each value of a multi-valued attribute”?“බහු අගය උපලක්ෂණයක සෑම අගයක්ම ගබඩා කරන වෙනම වගුව” යන්නෙන් අදහස් වන පදය කුමක්ද?
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: D
Multi-valued table – Separate table that stores each value of a multi-valued attribute.බහු අගය වගුව – බහු අගය උපලක්ෂණයක සෑම අගයක්ම ගබඩා කරන වෙනම වගුව.
20Which term means: “The process of converting a conceptual model into a logical model”?“සංකල්පීය ආකෘතියක් තාර්කික ආකෘතියක් බවට හැරවීම” යන්නෙන් අදහස් වන පදය කුමක්ද?
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: E
Mapping – The process of converting a conceptual model into a logical model.සිතියම්ගත කිරීම – සංකල්පීය ආකෘතියක් තාර්කික ආකෘතියක් බවට හැරවීම.
MCQ answer keyMCQ පිළිතුරු
- B – Table.වගුව.
- E – PK.PK.
- D – Many side.“බොහෝ” පැත්ත.
- C – Linking table.සම්බන්ධක වගුව.
- A – 3 + 1.3 + 1.
- C – Composite.සංයුක්ත.
- A – Separate table.වෙනම වගුව.
- E – Parts.කොටස්.
- D – Entity transformation – Turning each entity into a table.ආයතන පරිවර්තනය – සෑම ආයතනයක්ම වගුවක් බවට හැරවීම.
- E – Attribute transformation – Turning attributes into columns of a table.උපලක්ෂණ පරිවර්තනය – උපලක්ෂණ වගු තීරු බවට හැරවීම.
- B – Relationship transformation – Turning relationships into foreign keys or linking tables.සම්බන්ධතා පරිවර්තනය – සම්බන්ධතා FK හෝ සම්බන්ධක වගු බවට හැරවීම.
- A – Linking table – Table created for an M:N relationship holding both keys.සම්බන්ධක වගුව – යතුරු දෙකම ඇති M:N සඳහා සාදන වගුව.
- B – One-to-many rule – The key of the one side goes into the many side.එකට-බොහෝ නීතිය – “එක” පැත්තේ යතුර “බොහෝ” පැත්තට යයි.
- C – Many-to-many rule – A new table with both primary keys is created.බොහෝ-ට-බොහෝ නීතිය – ප්රාථමික යතුරු දෙකම සහිත නව වගුවක් සාදයි.
- D – One-to-one rule – The key of one side is placed as a unique foreign key in the other.එකට-එක නීතිය – එක් පැත්තක යතුර අනෙකේ අනන්ය FK ලෙස තබයි.
- A – Composite primary key – Primary key made from two or more columns.සංයුක්ත ප්රාථමික යතුර – තීරු දෙකක් හෝ වැඩියෙන් සෑදූ ප්රාථමික යතුර.
- C – Strong entity – Entity with its own identifier.ප්රබල ආයතනය – තමන්ගේම හඳුනාගැනීමක් ඇති ආයතනය.
- B – Weak entity – Entity that depends on another for its identity.දුර්වල ආයතනය – හඳුනාගැනීම සඳහා අනෙකක් මත රඳා පවතින ආයතනය.
- D – Multi-valued table – Separate table that stores each value of a multi-valued attribute.බහු අගය වගුව – බහු අගය උපලක්ෂණයක සෑම අගයක්ම ගබඩා කරන වෙනම වගුව.
- E – Mapping – The process of converting a conceptual model into a logical model.සිතියම්ගත කිරීම – සංකල්පීය ආකෘතියක් තාර්කික ආකෘතියක් බවට හැරවීම.
Structured Questionsව්යුහගත ප්රශ්න
1State the rules to transform entities and attributes.ආයතන සහ උපලක්ෂණ නීති. (5 marksලකුණු 5)
Show model answerආදර්ශ පිළිතුර පෙන්වන්න
2Explain the transformation of 1:1, 1:N and M:N relationships.සම්බන්ධතා පරිවර්තනය. (3 marksලකුණු 3)
Show model answerආදර්ශ පිළිතුර පෙන්වන්න
3Transform the school ER diagram into a logical schema.පාසල් ER. (4 marksලකුණු 4)
Show model answerආදර්ශ පිළිතුර පෙන්වන්න
4Transform the library ER (Member M:N Book, Publisher 1:N Book).පුස්තකාල ER. (4 marksලකුණු 4)
Show model answerආදර්ශ පිළිතුර පෙන්වන්න
5Why is a derived attribute normally not stored?ව්යුත්පන්න ගබඩා නොකරන්නේ? (3 marksලකුණු 3)
Show model answerආදර්ශ පිළිතුර පෙන්වන්න
🎮 Game🎮 ක්රීඩා
Summary & Downloadsසාරාංශය සහ බාගත කිරීම්
Key pointsප්රධාන කරුණු
- Entity → table; identifier → primary key.ආයතනය → වගුව; හඳුනාගැනීම → PK.
- Attribute → column; composite → parts.උපලක්ෂණය → තීරුව; සංයුක්ත → කොටස්.
- 1:N → foreign key in the many side.1:N → “බොහෝ” පැත්තේ FK.
- M:N → linking table with a composite key.M:N → සංයුක්ත යතුර සහිත සම්බන්ධක වගුව.
- Multi-valued → separate table.බහු අගය → වෙනම වගුව.
