Transforming ER Diagrams to a Logical Schema – Grade 13 A/L ICT Notes 8.6

© 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

Prints all tabs in the language you are reading. Use “Save as PDF” in the print window to keep a copy.ඔබ කියවන භාෂාවෙන් සියලු tabs මුද්‍රණය වේ. පිටපතක් තියාගන්න print window එකේ “Save as PDF” තෝරන්න.
🎬Video coming soon in this language. Switch language to watch the other video.මේ භාෂාවෙන් වීඩියෝව ඉක්මනින් එනවා. අනෙක් වීඩියෝව බලන්න භාෂාව මාරු කරන්න.

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.බහු අගය → වෙනම වගුව.
Entity transformationAttribute transformationRelationship transformationLinking tableOne-to-many ruleMany-to-many ruleOne-to-one rule

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. සම්බන්ධතා පරිවර්තනය

ER → tables: 1:N adds a foreign key, M:N adds a new tableClassStudent1:NStudent(StudentID, Name, ClassID)StudentSubjectM:NStudent_Subject(StudentID, SubjectCode)Entity → table · attribute → column · identifier → primary key
1:N and M:N transformation1:N සහ M:N පරිවර්තනය
CardinalityගණනීයතාවRuleනීතියExampleඋදාහරණය
1:11:1Put the PK of one side as a FK (often UNIQUE) in the otherඑක් පැත්තක PK අනෙකේ FK ලෙස (බොහෝ විට UNIQUE)School(…, PrincipalID)School(…, PrincipalID)
1:N1:NPut the PK of the “1” side as a FK in the “N” side“1” පැත්තේ PK “N” පැත්තේ FK ලෙසStudent(…, ClassID)Student(…, ClassID)
M:NM:NCreate a new table with both PKs as a composite PKPK දෙකම සංයුක්ත PK ලෙස ඇති නව වගුවක්Student_Subject(StudentID, SubjectCode)Student_Subject(StudentID, SubjectCode)
🧮 Worked exampleවිසඳූ උදාහරණය Transform the school ER diagram (Class 1:N Student, Student M:N Subject).පාසල් ER රූපය පරිවර්තනය කරන්න.
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).

💡 Count tables: one per entity + one per M:N relationship + one per multi-valued attribute.වගු ගණන: ආයතනයකට එකක් + M:N එකකට එකක් + බහු අගය උපලක්ෂණයකට එකක්.
🚀 Beyond the syllabus (2026 update)🚀 විෂය නිර්දේශයෙන් ඔබ්බට (2026 යාවත්කාලීනය) Not required for the exam – read for interest.විභාගයට අවශ්‍ය නැත – දැනුම සඳහා කියවන්න. ORM tools in 2026 (used with web frameworks) generate these tables automatically from class diagrams, using the same rules.2026 ORM මෙවලම් එකම නීති භාවිතයෙන් class රූපවලින් මෙම වගු ස්වයංක්‍රීයව සාදයි.

Key Wordsප්‍රධාන පද

Entity transformationආයතන පරිවර්තනය
Turning each entity into a table.සෑම ආයතනයක්ම වගුවක් බවට හැරවීම.
Attribute transformationඋපලක්ෂණ පරිවර්තනය
Turning attributes into columns of a table.උපලක්ෂණ වගු තීරු බවට හැරවීම.
Relationship transformationසම්බන්ධතා පරිවර්තනය
Turning relationships into foreign keys or linking tables.සම්බන්ධතා FK හෝ සම්බන්ධක වගු බවට හැරවීම.
Linking tableසම්බන්ධක වගුව
Table created for an M:N relationship holding both keys.යතුරු දෙකම ඇති M:N සඳහා සාදන වගුව.
One-to-many ruleඑකට-බොහෝ නීතිය
The key of the one side goes into the many side.“එක” පැත්තේ යතුර “බොහෝ” පැත්තට යයි.
Many-to-many ruleබොහෝ-ට-බොහෝ නීතිය
A new table with both primary keys is created.ප්‍රාථමික යතුරු දෙකම සහිත නව වගුවක් සාදයි.
One-to-one ruleඑකට-එක නීතිය
The key of one side is placed as a unique foreign key in the other.එක් පැත්තක යතුර අනෙකේ අනන්‍ය FK ලෙස තබයි.
Composite primary keyසංයුක්ත ප්‍රාථමික යතුර
Primary key made from two or more columns.තීරු දෙකක් හෝ වැඩියෙන් සෑදූ ප්‍රාථමික යතුර.
Strong entityප්‍රබල ආයතනය
Entity with its own identifier.තමන්ගේම හඳුනාගැනීමක් ඇති ආයතනය.
Weak entityදුර්වල ආයතනය
Entity that depends on another for its identity.හඳුනාගැනීම සඳහා අනෙකක් මත රඳා පවතින ආයතනය.
Multi-valued tableබහු අගය වගුව
Separate table that stores each value of a multi-valued attribute.බහු අගය උපලක්ෂණයක සෑම අගයක්ම ගබඩා කරන වෙනම වගුව.
Mappingසිතියම්ගත කිරීම
The process of converting a conceptual model into a logical model.සංකල්පීය ආකෘතියක් තාර්කික ආකෘතියක් බවට හැරවීම.

Sample Q&Aආදර්ශ ප්‍රශ්න සහ පිළිතුරු

1How is an entity transformed?ආයතනයක් පරිවර්තනය?

Answerපිළිතුර: Into a table; its identifier becomes the primary key.වගුවක්; හඳුනාගැනීම PK වේ.

2How is a 1:N relationship transformed?1:N පරිවර්තනය?

Answerපිළිතුර: The PK of the one side is added as FK to the many side.“එක” පැත්තේ PK “බොහෝ” පැත්තට FK ලෙස.

3How is an M:N relationship transformed?M:N පරිවර්තනය?

Answerපිළිතුර: A linking table with both PKs as a composite key.PK දෙකම සහිත සම්බන්ධක වගුවක්.

4How many tables for the school ER?පාසල් ER වගු ගණන?

Answerපිළිතුර: 4.4.

5Where does DateBorrowed go?DateBorrowed යන්නේ?

Answerපිළිතුර: Into the linking table Borrow.Borrow සම්බන්ධක වගුවට.

6How is a multi-valued attribute stored?බහු අගය ගබඩා කරන්නේ?

Answerපිළිතුර: In a separate table with the owner key.හිමිකරු යතුර සමඟ වෙනම වගුවක.

MCQබහුවරණ ප්‍රශ්න

Choose the correct answer for each question.සෑම ප්‍රශ්නයකටම නිවැරදි පිළිතුර තෝරන්න.

Scoreලකුණු: 0 / 20

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 පිළිතුරු

  1. B – Table.වගුව.
  2. E – PK.PK.
  3. D – Many side.“බොහෝ” පැත්ත.
  4. C – Linking table.සම්බන්ධක වගුව.
  5. A – 3 + 1.3 + 1.
  6. C – Composite.සංයුක්ත.
  7. A – Separate table.වෙනම වගුව.
  8. E – Parts.කොටස්.
  9. D – Entity transformation – Turning each entity into a table.ආයතන පරිවර්තනය – සෑම ආයතනයක්ම වගුවක් බවට හැරවීම.
  10. E – Attribute transformation – Turning attributes into columns of a table.උපලක්ෂණ පරිවර්තනය – උපලක්ෂණ වගු තීරු බවට හැරවීම.
  11. B – Relationship transformation – Turning relationships into foreign keys or linking tables.සම්බන්ධතා පරිවර්තනය – සම්බන්ධතා FK හෝ සම්බන්ධක වගු බවට හැරවීම.
  12. A – Linking table – Table created for an M:N relationship holding both keys.සම්බන්ධක වගුව – යතුරු දෙකම ඇති M:N සඳහා සාදන වගුව.
  13. B – One-to-many rule – The key of the one side goes into the many side.එකට-බොහෝ නීතිය – “එක” පැත්තේ යතුර “බොහෝ” පැත්තට යයි.
  14. C – Many-to-many rule – A new table with both primary keys is created.බොහෝ-ට-බොහෝ නීතිය – ප්‍රාථමික යතුරු දෙකම සහිත නව වගුවක් සාදයි.
  15. D – One-to-one rule – The key of one side is placed as a unique foreign key in the other.එකට-එක නීතිය – එක් පැත්තක යතුර අනෙකේ අනන්‍ය FK ලෙස තබයි.
  16. A – Composite primary key – Primary key made from two or more columns.සංයුක්ත ප්‍රාථමික යතුර – තීරු දෙකක් හෝ වැඩියෙන් සෑදූ ප්‍රාථමික යතුර.
  17. C – Strong entity – Entity with its own identifier.ප්‍රබල ආයතනය – තමන්ගේම හඳුනාගැනීමක් ඇති ආයතනය.
  18. B – Weak entity – Entity that depends on another for its identity.දුර්වල ආයතනය – හඳුනාගැනීම සඳහා අනෙකක් මත රඳා පවතින ආයතනය.
  19. D – Multi-valued table – Separate table that stores each value of a multi-valued attribute.බහු අගය වගුව – බහු අගය උපලක්ෂණයක සෑම අගයක්ම ගබඩා කරන වෙනම වගුව.
  20. 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ආදර්ශ පිළිතුර පෙන්වන්න
Entity table; identifier PK; simple column; composite parts; multi-valued table.වගුව; PK; තීරු; කොටස්; වගුව.

2Explain the transformation of 1:1, 1:N and M:N relationships.සම්බන්ධතා පරිවර්තනය. (3 marksලකුණු 3)

Show model answerආදර්ශ පිළිතුර පෙන්වන්න
1:1 unique FK; 1:N FK in many side; M:N linking table.1:1; 1:N; M:N.

3Transform the school ER diagram into a logical schema.පාසල් ER. (4 marksලකුණු 4)

Show model answerආදර්ශ පිළිතුර පෙන්වන්න
Class; Student with ClassID FK; Subject; Student_Subject composite key.Class; Student; Subject; Student_Subject.

4Transform the library ER (Member M:N Book, Publisher 1:N Book).පුස්තකාල ER. (4 marksලකුණු 4)

Show model answerආදර්ශ පිළිතුර පෙන්වන්න
Member; Publisher; Book with PublisherID FK; Borrow(MemberNo, ISBN, DateBorrowed).Member; Publisher; Book; Borrow.

5Why is a derived attribute normally not stored?ව්‍යුත්පන්න ගබඩා නොකරන්නේ? (3 marksලකුණු 3)

Show model answerආදර්ශ පිළිතුර පෙන්වන්න
Can be calculated; avoids redundancy; avoids out-of-date values.ගණනය කළ හැක; අතිරික්තතාව නැත.

🎮 Game🎮 ක්‍රීඩා

Pick a game. Each one uses words from this lesson.ක්‍රීඩාවක් තෝරන්න. හැම එකක්ම මේ පාඩමේ වචන පාවිච්චි කරනවා.

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.බහු අගය → වෙනම වගුව.

Downloadsබාගත කිරීම්

Full Lesson 8 PDFසම්පූර්ණ පාඩම 8 PDF: English · සිංහල

Next noteඊළඟ සටහන 8.7 →

© 2026 schoolict.net (Ruwan Mangala Suraweera). All rights reserved.සියලු හිමිකම් ඇවිරිණි.