© 2026 schoolict.net (Ruwan Mangala Suraweera)
9.5 Creating a Relational Database Using a DBMS (MS Access and LibreOffice Base)DBMS එකක් භාවිතයෙන් සම්බන්ධක දත්ත සමුදායක් සෑදීම (MS Access සහ LibreOffice Base)
G.C.E. O/L Grade 10 ICT · Lesson 9G.C.E. O/L ICT · 10 ශ්රේණිය · පාඩම 9
In this videoමේ වීඩියෝවේ
- Access: Blank database (.accdb); Base: Wizard (.odb).Access: Blank database (.accdb); Base: Wizard (.odb).
- Design View: field names, data types, properties.Design View: field names, data types, properties.
- Primary Key button sets the key field.Primary Key බොත්තම key field එක සකසයි.
- Relationships window: drag PK onto FK.Relationships කවුළුව: PK, FK මතට drag.
- Tick Enforce Referential Integrity; back up the file.Enforce Referential Integrity tick; ගොනුව backup.
Notesසටහන්
Now we build the school database on the computer. You will create a database file, make the tables in Design View, set the primary keys, identify the foreign keys, and join the tables in the Relationships window with Enforce Referential Integrity. Steps are given for MS Access and LibreOffice Base.දැන් අපි පාසල් දත්ත සමුදාය පරිගණකයේ ගොඩනගමු. ඔබ දත්ත සමුදාය ගොනුවක් සාදා, Design View හි tables සාදා, primary keys සකසා, foreign keys හඳුනාගෙන, Enforce Referential Integrity සමඟ Relationships කවුළුවේ tables සම්බන්ධ කරනු ඇත. MS Access සහ LibreOffice Base සඳහා පියවර දී ඇත.
1. Create a new database1. නව දත්ත සමුදායක් සෑදීම
| Stepපියවර | MS AccessMS Access | LibreOffice BaseLibreOffice Base |
|---|---|---|
| Startආරම්භය | File › New › Blank databaseFile › New › Blank database | Database Wizard › Create a new database (HSQLDB/Firebird embedded)Database Wizard › Create a new database (HSQLDB/Firebird embedded) |
| Name and saveනම් කර save | Type SchoolDB › Create (saved as SchoolDB.accdb)SchoolDB › Create (SchoolDB.accdb ලෙස save) | Finish › save as SchoolDB.odbFinish › SchoolDB.odb ලෙස save |
| ObjectsObjects | Navigation Pane: Tables, Queries, Forms, ReportsNavigation Pane: Tables, Queries, Forms, Reports | Left pane: Tables, Queries, Forms, Reportsවම් pane: Tables, Queries, Forms, Reports |
2. Create tables in Design View2. Design View හි tables සෑදීම
- Access: Create › Table Design. Base: Tables › Create Table in Design View.Access: Create › Table Design. Base: Tables › Create Table in Design View.
- Type each Field Name, choose its Data Type, add a Description.සෑම Field Name එකක්ම type කර Data Type තෝරා Description එකතු කරන්න.
- Set Field Properties at the bottom: Field Size, Format, Caption, Default Value, Validation Rule (e.g. Between 0 And 100), Required.පහළින් Field Properties: Field Size, Format, Caption, Default Value, Validation Rule (උදා Between 0 And 100), Required.
- Switch to Datasheet View to type records.Records type කිරීමට Datasheet View වෙත මාරු වන්න.
3. Set the primary key3. Primary key සැකසීම
Select the field row (e.g. AdmNo) and click Table Design › Primary Key (key icon) in Access, or right-click › Primary Key in Base. A key symbol appears. Access sets Indexed: Yes (No Duplicates), so a repeated or empty AdmNo is refused. Save the table as tblStudent. Make all 4 tables: tblClass, tblStudent, tblBook and tblBorrow.Field පේළිය (උදා AdmNo) තෝරා Access හි Table Design › Primary Key (key icon) click කරන්න, නැතහොත් Base හි right-click › Primary Key. Key සංකේතයක් දිස්වේ. Access Indexed: Yes (No Duplicates) සකසන නිසා නැවත යෙදෙන හෝ හිස් AdmNo ප්රතික්ෂේප වේ. Table එක tblStudent ලෙස save කරන්න. Tables 4 ම සාදන්න: tblClass, tblStudent, tblBook සහ tblBorrow.
4. Identify foreign keys4. Foreign keys හඳුනා ගැනීම
| Foreign keyForeign key | In tableTable එකේ | Refers to PK ofPK එකට යොමු වන්නේ |
|---|---|---|
| ClassIDClassID | tblStudenttblStudent | tblClass.ClassIDtblClass.ClassID |
| BookIDBookID | tblBorrowtblBorrow | tblBook.BookIDtblBook.BookID |
| AdmNoAdmNo | tblBorrowtblBorrow | tblStudent.AdmNotblStudent.AdmNo |
5. Create relationships5. සම්බන්ධතා සෑදීම
- Close all tables. Access: Database Tools › Relationships. Base: Tools › Relationships.සියලු tables වසන්න. Access: Database Tools › Relationships. Base: Tools › Relationships.
- Add (Show Table) tblClass, tblStudent, tblBook and tblBorrow.tblClass, tblStudent, tblBook සහ tblBorrow Add (Show Table) කරන්න.
- Drag the PK (tblClass.ClassID) onto the FK (tblStudent.ClassID).PK (tblClass.ClassID) FK (tblStudent.ClassID) මතට drag කරන්න.
- In Edit Relationships tick Enforce Referential Integrity › Create. The line shows 1 and ∞.Edit Relationships හි Enforce Referential Integrity tick කර › Create. රේඛාවේ 1 සහ ∞ පෙන්වයි.
- Repeat for BookID and AdmNo into tblBorrow – 3 relationships in total. Save the layout.tblBorrow තුළ BookID සහ AdmNo සඳහා නැවත කරන්න – සම්බන්ධතා 3 ක්. Layout එක save කරන්න.
Key Wordsප්රධාන පද
Sample Q&Aආදර්ශ ප්රශ්න සහ පිළිතුරු
1How do you create a new database in Access?Access හි නව දත්ත සමුදායක් සාදන්නේ කෙසේද?
2How is a primary key set?Primary key සකසන්නේ කෙසේද?
3How do you open the Relationships window?Relationships කවුළුව විවෘත කරන්නේ කෙසේද?
4What does Enforce Referential Integrity do?Enforce Referential Integrity කරන්නේ කුමක්ද?
5Which tables should be filled first?පළමුව පිරවිය යුතු tables මොනවාද?
6What data type must an FK have when the PK is AutoNumber?PK AutoNumber විට FK හි data type කුමක් විය යුතුද?
MCQබහුවරණ ප්රශ්න
Choose the correct answer for each question.සෑම ප්රශ්නයකටම නිවැරදි පිළිතුර තෝරන්න.
1The file extension of an MS Access database is…MS Access දත්ත සමුදායක ගොනු දිගුව…
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: D
Access.Access.
2The file extension of a LibreOffice Base database is…LibreOffice Base දත්ත සමුදායක ගොනු දිගුව…
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: C
Base.Base.
3Field names and data types are defined in…Field names සහ data types නිර්වචනය කරන්නේ…
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: A
Design View.Design View.
4Records are typed in a table in…Table එකක records type කරන්නේ…
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: B
Datasheet.Datasheet.
5In Access, the Relationships window is on the… tab.Access හි Relationships කවුළුව ඇත්තේ… tab එකේ.
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: A
Database Tools.Database Tools.
6To create a relationship you drag…සම්බන්ධතාවක් සෑදීමට drag කරන්නේ…
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: C
PK → FK.PK → FK.
7The option that stops a loan for a book that does not exist is…නොපවතින පොතක් සඳහා ණයක් වළක්වන විකල්පය…
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: C
Integrity.Integrity.
8With referential integrity, deleting class 10A that still has students is…Referential integrity සමඟ සිසුන් සිටින 10A පන්තිය මැකීම…
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: D
Protects data.දත්ත ආරක්ෂා කරයි.
9A validation rule that accepts ICT marks only from 0 to 100 is…ICT ලකුණු 0 සිට 100 දක්වා පමණක් පිළිගන්නා validation rule එක…
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: C
Between.Between.
10BorrowID is AutoNumber. A FK that refers to it should be…BorrowID AutoNumber වේ. එයට යොමු වන FK විය යුත්තේ…
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: A
Long Integer.Long Integer.
11In the school database, how many relationships are created?පාසල් දත්ත සමුදායේ සම්බන්ධතා කීයක් සාදයි?
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: B
Class–Student, Book–Borrow, Student–Borrow.Class–Student, Book–Borrow, Student–Borrow.
12Which table should be filled before tblStudent?tblStudent ට පෙර පිරවිය යුතු table එක කුමක්ද?
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: B
One side first.One පැත්ත පළමුව.
13‘Cascade Delete Related Records’ means deleting a class also…‘Cascade Delete Related Records’ යනු පන්තියක් මැකීමෙන්…
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: A
Careful!ප්රවේශමෙන්!
14In Access, a primary key field automatically gets…Access හි primary key field එකකට ස්වයංක්රීයව ලැබෙන්නේ…
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: D
No duplicates.අනුපිටපත් නැත.
15A safe habit for a school database file is to…පාසල් දත්ත සමුදාය ගොනුවක් සඳහා ආරක්ෂිත පුරුද්දක් වන්නේ…
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: B
Backup.Backup.
MCQ answer keyMCQ පිළිතුරු
- D – Access.Access.
- C – Base.Base.
- A – Design View.Design View.
- B – Datasheet.Datasheet.
- A – Database Tools.Database Tools.
- C – PK → FK.PK → FK.
- C – Integrity.Integrity.
- D – Protects data.දත්ත ආරක්ෂා කරයි.
- C – Between.Between.
- A – Long Integer.Long Integer.
- B – Class–Student, Book–Borrow, Student–Borrow.Class–Student, Book–Borrow, Student–Borrow.
- B – One side first.One පැත්ත පළමුව.
- A – Careful!ප්රවේශමෙන්!
- D – No duplicates.අනුපිටපත් නැත.
- B – Backup.Backup.
Structured Questionsව්යුහගත ප්රශ්න
1List the steps to create tblStudent with AdmNo as the primary key in MS Access. (4 marks)MS Access හි AdmNo primary key ලෙස tblStudent සාදන පියවර ලැයිස්තු කරන්න. (ලකුණු 4) (4 marksලකුණු 4)
Show model answerආදර්ශ පිළිතුර පෙන්වන්න
2Explain how to create the relationship between tblClass and tblStudent with referential integrity. (4 marks)Referential integrity සමඟ tblClass සහ tblStudent අතර සම්බන්ධතාව සාදන ආකාරය පැහැදිලි කරන්න. (ලකුණු 4) (4 marksලකුණු 4)
Show model answerආදර්ශ පිළිතුර පෙන්වන්න
3(i) What is a validation rule? (1 mark)
(ii) Write one for ICTMarks. (1 mark)(i) Validation rule යනු කුමක්ද? (ලකුණු 1)
(ii) ICTMarks සඳහා එකක් ලියන්න. (ලකුණු 1) (2 marksලකුණු 2)
Show model answerආදර්ශ පිළිතුර පෙන්වන්න
4Give two effects of ticking Enforce Referential Integrity. (2 marks)Enforce Referential Integrity tick කිරීමේ බලපෑම් දෙකක් දෙන්න. (ලකුණු 2) (2 marksලකුණු 2)
Show model answerආදර්ශ පිළිතුර පෙන්වන්න
5Compare MS Access and LibreOffice Base: give the file extension of each and one similarity. (3 marks)MS Access සහ LibreOffice Base සසඳන්න: එක් එකක ගොනු දිගුව සහ සමානකමක් දෙන්න. (ලකුණු 3) (3 marksලකුණු 3)
Show model answerආදර්ශ පිළිතුර පෙන්වන්න
🎮 Game🎮 ක්රීඩා
Summary & Downloadsසාරාංශය සහ බාගත කිරීම්
Key pointsප්රධාන කරුණු
- Access: Blank database → .accdb; Base: Wizard → .odb.Access: Blank database → .accdb; Base: Wizard → .odb.
- Design View: field names, data types, properties.Design View: field names, data types, properties.
- Datasheet View: type and view records.Datasheet View: records type කර බැලීම.
- Primary Key button sets the unique field.Primary Key බොත්තම අනන්ය field එක සකසයි.
- FK has the same type/size as its PK.FK හට PK එකේ එකම type/size.
- Relationships window: drag PK onto FK.Relationships කවුළුව: PK, FK මතට drag.
- Tick Enforce Referential Integrity (1–∞).Enforce Referential Integrity tick (1–∞).
- Back up and password-protect the database.දත්ත සමුදාය backup කර මුරපදයෙන් ආරක්ෂා කරන්න.
