Creating a Simple Database Table: Fields, Data Types and Field Size – Grade 10 ICT Notes 9.2

© 2026 schoolict.net (Ruwan Mangala Suraweera)

9.2 Creating a Simple Database Table: Fields, Data Types and Field Sizeසරල දත්ත සමුදාය Table එකක් සෑදීම: Fields, Data Types සහ Field Size

G.C.E. O/L Grade 10 ICT · Lesson 9G.C.E. O/L ICT · 10 ශ්‍රේණිය · පාඩම 9

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මේ වීඩියෝවේ

  • Plan first: purpose of the table.පළමුව සැලසුම: table එකේ අරමුණ.
  • Choose clear field names (StudentName, ICTMarks).පැහැදිලි field names තෝරන්න (StudentName, ICTMarks).
  • Pick a unique field for the primary key (AdmNo).Primary key සඳහා අනන්‍ය field එකක් (AdmNo).
  • Data types: Short Text, Number, Currency, Date/Time, Yes/No, AutoNumber.Data types: Short Text, Number, Currency, Date/Time, Yes/No, AutoNumber.
  • Set a field size just large enough.ප්‍රමාණවත් තරම් field size එකක් සකසන්න.
Field nameData typeShort TextNumberYes/NoAutoNumberField size

Notesසටහන්

Before you open a DBMS, plan the table on paper. Decide the purpose, the field names, a unique field (primary key), the data type of each field and its field size. A good plan saves time and stops mistakes. In this note we plan a single table, tblBook, for the school library.DBMS එකක් විවෘත කිරීමට පෙර කඩදාසි මත table එක සැලසුම් කරන්න. අරමුණ, field names, අනන්‍ය field එක (primary key), එක් එක් field එකේ data type සහ field size තීරණය කරන්න. හොඳ සැලැස්මක් කාලය ඉතිරි කර දෝෂ වළක්වයි. මෙම සටහනේ පාසල් පුස්තකාලය සඳහා tblBook නම් තනි table එකක් සැලසුම් කරමු.

1. Steps to design a table1. Table එකක් සැලසුම් කිරීමේ පියවර

  • Purpose – what information is needed? (e.g. ‘Which books are in the library, their price and number of copies?’)අරමුණ – අවශ්‍ය තොරතුරු මොනවාද? (උදා ‘පුස්තකාලයේ ඇති පොත්, ඒවායේ මිල සහ පිටපත් ගණන?’)
  • Field names – short, meaningful, no spaces is best: BookID, Title, Author, Category, Price, Copies.Field names – කෙටි, අර්ථවත්, හිස්තැන් නැතිව වඩා හොඳයි: BookID, Title, Author, Category, Price, Copies.
  • Unique field – choose the primary key: BookID (accession number) – no two books share it.අනන්‍ය field – primary key තෝරන්න: BookID (accession අංකය) – පොත් දෙකකට එය පොදු නොවේ.
  • Data type – the kind of data each field holds.Data type – එක් එක් field එකේ ඇති දත්ත වර්ගය.
  • Field size – the maximum length (text) or range (number).Field size – උපරිම දිග (text) හෝ පරාසය (number).
  • Sample data – test the plan with a few real records.නියැදි දත්ත – සැබෑ records කිහිපයකින් සැලැස්ම පරීක්ෂා කරන්න.

2. Data types2. Data types

Data type (Access)Data type (Access)LibreOffice BaseLibreOffice BaseStoresගබඩා කරන්නේSchool exampleපාසල් උදාහරණය
Short TextShort TextText [VARCHAR]Text [VARCHAR]Letters, or numbers not used in calculations – up to 255 charactersඅකුරු, හෝ ගණනයට නොගන්නා අංක – අක්ෂර 255 දක්වාStudentName, ClassID, phone numberStudentName, ClassID, දුරකථන අංකය
Long Text (Memo)Long Text (Memo)Memo [LONGVARCHAR]Memo [LONGVARCHAR]Long text – remarks, descriptionsදිගු පෙළ – සටහන්, විස්තරTeacher’s remarksගුරු සටහන්
NumberNumberInteger / DecimalInteger / DecimalNumbers used in calculationsගණනයට භාවිත කරන අංකICTMarks, Copies, RoomICTMarks, Copies, Room
Date/TimeDate/TimeDateDateDates and timesදින සහ වේලාවන්DateOfBirth, DateBorrowedDateOfBirth, DateBorrowed
CurrencyCurrencyDecimal (Currency format)Decimal (Currency format)Money values (Rs.)මුදල් අගයන් (රු.)Book Price, facility feeපොතේ මිල, පහසුකම් ගාස්තුව
Yes/NoYes/NoYes/No [BOOLEAN]Yes/No [BOOLEAN]Only two values: Yes/No, True/Falseඅගයන් දෙකක් පමණි: Yes/No, True/FalsePrefect, ReturnedPrefect, Returned
AutoNumberAutoNumberInteger + AutoValueInteger + AutoValueA number added automatically (1, 2, 3 …), uniqueස්වයංක්‍රීයව එකතු වන අනන්‍ය අංකයක් (1, 2, 3 …)BorrowIDBorrowID
💡 A telephone number (e.g. 0712345678) or NIC number (e.g. 200912345678) is stored as Short Text – we never add phone numbers, and a leading 0 must be kept.දුරකථන අංකයක් (උදා 0712345678) හෝ NIC අංකයක් (උදා 200912345678) Short Text ලෙස ගබඩා කරයි – දුරකථන අංක එකතු නොකරන අතර මුල 0 රැකිය යුතුය.

3. Field size3. Field size

For Short Text, the field size is the maximum number of characters (1–255; default 255). For Number, it is the kind of number: Byte (0–255), Integer (−32,768 to 32,767), Long Integer (about ±2.1 billion), Single/Double (decimals). A small, suitable size saves space and stops wrong data – e.g. ClassID size 3 accepts ’10A’ but not ’10A-Science’.Short Text සඳහා field size යනු උපරිම අක්ෂර ගණනයි (1–255; පෙරනිමි 255). Number සඳහා එය අංක වර්ගයයි: Byte (0–255), Integer (−32,768 සිට 32,767), Long Integer (ආසන්න වශයෙන් ±බිලියන 2.1), Single/Double (දශම). කුඩා සුදුසු ප්‍රමාණයක් ඉඩ ඉතිරි කර වැරදි දත්ත වළක්වයි – උදා ClassID size 3 ’10A’ පිළිගන්නා නමුත් ’10A-Science’ නොපිළිගනී.

4. The plan for tblBook4. tblBook සැලැස්ම

Field nameField nameData typeData typeField sizeField sizeDescriptionවිස්තරය
BookIDBookIDShort TextShort Text44Accession number, e.g. B001 (primary key)Accession number, e.g. B001 (primary key)
TitleTitleShort TextShort Text6060Book titleBook title
AuthorAuthorShort TextShort Text4040AuthorAuthor
CategoryCategoryShort TextShort Text1515Novel, Reference …Novel, Reference …
PricePriceCurrencyCurrencyRs.Rs.Price in rupeesPrice in rupees
CopiesCopiesNumberNumberIntegerIntegerCopies in the libraryCopies in the library
tblStudent – Design View (MS Access)Table Design: 🔑 Primary Key Builder Test Validation Rules Insert Rows Delete RowsField NameData TypeDescription (optional)🔑AdmNoNumberAdmission number (primary key)StudentNameShort TextFull nameClassIDShort TextClass (foreign key → tblClass)DateOfBirthDate/TimeDate of birthICTMarksNumberTerm test mark out of 100PrefectYes/NoIs the student a prefect?Field Properties – StudentName (General tab)Field Size40FormatInput MaskCaptionStudent nameDefault ValueValidation RuleRequired: Yes · Indexed: Yes (No Duplicates) for the primary key
Figure 9.2: The plan typed into Access Design View (tblStudent). Each field has a name, a data type and properties such as Field Size.රූපය 9.2: Access Design View හි ඇතුළත් කළ සැලැස්ම (tblStudent). සෑම field එකකටම නමක්, data type එකක් සහ Field Size වැනි properties ඇත.
💡 Sample record: B001 | Madol Doova | Martin Wickramasinghe | Novel | Rs. 750 | 3. Check: does every value fit its type and size? ‘Madol Doova’ has 11 characters ≤ 60 ✔.නියැදි record: B001 | Madol Doova | Martin Wickramasinghe | Novel | රු. 750 | 3. පරීක්ෂා කරන්න: සෑම අගයක්ම type සහ size එකට ගැළපේද? ‘Madol Doova’ අක්ෂර 11 ≤ 60 ✔.
NEW 20262026 නව 2026: AI as a helper, not a replacement. You can ask an AI chatbot to suggest fields and data types for a ‘school sports meet’ table, but you must check every suggestion (e.g. it may make a phone number a Number field) and never paste real student personal data into a public AI tool.2026: AI උදව්කරුවෙකු ලෙස, ආදේශකයක් ලෙස නොවේ. ‘පාසල් ක්‍රීඩා උත්සවය’ table එකක් සඳහා fields සහ data types *යෝජනා* කිරීමට AI chatbot එකකින් ඉල්ලිය හැකි නමුත් සෑම යෝජනාවක්ම ඔබ පරීක්ෂා කළ යුතුය (උදා එය දුරකථන අංකයක් Number field එකක් කළ හැක) සහ සැබෑ ශිෂ්‍ය පුද්ගලික දත්ත පොදු AI මෙවලමකට කිසිදා ඇතුළත් නොකරන්න.

Key Wordsප්‍රධාන පද

Field nameField name
The name given to a field, e.g. StudentName.Field එකකට දෙන නම, උදා StudentName.
Data typeData type
The kind of data a field can hold.Field එකකට රඳවා ගත හැකි දත්ත වර්ගය.
Short TextShort Text
Text up to 255 characters; also numbers not calculated.අක්ෂර 255 දක්වා පෙළ; ගණනය නොකරන අංක ද.
Long TextLong Text
Long text such as remarks (Memo).සටහන් වැනි දිගු පෙළ (Memo).
NumberNumber
Numeric data used in calculations.ගණනයට භාවිත කරන සංඛ්‍යාත්මක දත්ත.
CurrencyCurrency
Money values.මුදල් අගයන්.
Date/TimeDate/Time
Dates and times.දින සහ වේලාවන්.
Yes/NoYes/No
Only two possible values.හැකි අගයන් දෙකක් පමණි.
AutoNumberAutoNumber
A unique number given automatically to each new record.සෑම නව record එකකටම ස්වයංක්‍රීයව දෙන අනන්‍ය අංකය.
Field sizeField size
Maximum length or numeric range of a field.Field එකක උපරිම දිග හෝ සංඛ්‍යා පරාසය.
Unique fieldඅනන්‍ය field
A field with no repeated values; the primary key.නැවත නොයෙදෙන අගයන් ඇති field; primary key.
Purposeඅරමුණ
What information the table must give.Table එකෙන් ලැබිය යුතු තොරතුරු.

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

1List the steps in planning a table.Table එකක් සැලසුම් කිරීමේ පියවර ලැයිස්තු කරන්න.

Answerපිළිතුර: Purpose, field names, unique field (primary key), data types, field sizes, sample data.අරමුණ, field names, අනන්‍ය field (primary key), data types, field sizes, නියැදි දත්ත.

2Which data type is used for a book’s price?පොතක මිල සඳහා භාවිත කරන data type එක කුමක්ද?

Answerපිළිතුර: Currency.Currency.

3Why is a phone number stored as Short Text?දුරකථන අංකයක් Short Text ලෙස ගබඩා කරන්නේ ඇයි?

Answerපිළිතුර: It is not used in calculations and the leading 0 must be kept.එය ගණනයට නොගන්නා අතර මුල 0 රැකිය යුතුය.

4Give a field suitable for Yes/No.Yes/No ට සුදුසු field එකක් දෙන්න.

Answerපිළිතුර: Prefect, Returned, FeesPaid.Prefect, Returned, FeesPaid.

5What is field size for a Short Text field?Short Text field එකක field size යනු කුමක්ද?

Answerපිළිතුර: The maximum number of characters (1–255).උපරිම අක්ෂර ගණන (1–255).

6What does AutoNumber do?AutoNumber කරන්නේ කුමක්ද?

Answerපිළිතුර: Gives every new record a unique number automatically.සෑම නව record එකකටම ස්වයංක්‍රීයව අනන්‍ය අංකයක් දෙයි.

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

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

Scoreලකුණු: 0 / 15

1The best data type for StudentName is…StudentName සඳහා හොඳම data type එක…

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: B

Text.Text.

2The best data type for ICTMarks is…ICTMarks සඳහා හොඳම data type එක…

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: D

Calculated.ගණනය කරයි.

3Book price in rupees should be…රුපියල්වලින් පොතේ මිල විය යුත්තේ…

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: A

Money.මුදල්.

4A ‘Prefect’ field with only Yes or No uses…Yes හෝ No පමණක් ඇති ‘Prefect’ field එක භාවිත කරන්නේ…

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: B

Two values.අගයන් දෙකකි.

5DateOfBirth should be…DateOfBirth විය යුත්තේ…

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: A

Dates.දින.

6A mobile number such as 0712345678 should be stored as…0712345678 වැනි ජංගම අංකයක් ගබඩා කළ යුත්තේ…

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: C

Keep leading 0.මුල 0 රැකීම.

7A field that numbers new loans 1, 2, 3… automatically is…නව ණය 1, 2, 3… ලෙස ස්වයංක්‍රීයව අංක කරන field එක…

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: A

Auto.ස්වයංක්‍රීය.

8A teacher’s long remarks about a student need…සිසුවෙකු පිළිබඳ ගුරුවරයාගේ දිගු සටහන් සඳහා අවශ්‍ය වන්නේ…

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: D

Memo.Memo.

9The maximum field size of a Short Text field in Access is…Access හි Short Text field එකක උපරිම field size එක…

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: B

255 characters.අක්ෂර 255.

10ClassID values are like ’10A’. A suitable field size is…ClassID අගයන් ’10A’ වැනිය. සුදුසු field size එක…

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: A

3 characters.අක්ෂර 3.

11The Number field size that holds 0 to 255 only is…0 සිට 255 දක්වා පමණක් රඳවන Number field size එක…

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: C

Byte.Byte.

12The first step in planning a table is to decide its…Table එකක් සැලසුම් කිරීමේ පළමු පියවර වන්නේ එහි… තීරණය කිරීම

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: C

Purpose first.අරමුණ පළමුව.

13Which field is the unique field in tblBook?tblBook හි අනන්‍ය field එක කුමක්ද?

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: B

Accession number.Accession අංකය.

14In LibreOffice Base, the equivalent of Access ‘Short Text’ is…LibreOffice Base හි Access ‘Short Text’ ට සමාන වන්නේ…

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: D

VARCHAR.VARCHAR.

15When using an AI chatbot to suggest table fields, you should…Table fields යෝජනා කිරීමට AI chatbot එකක් භාවිත කරන විට ඔබ කළ යුත්තේ…

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: C

Responsible AI.වගකීම් සහිත AI.

MCQ answer keyMCQ පිළිතුරු

  1. B – Text.Text.
  2. D – Calculated.ගණනය කරයි.
  3. A – Money.මුදල්.
  4. B – Two values.අගයන් දෙකකි.
  5. A – Dates.දින.
  6. C – Keep leading 0.මුල 0 රැකීම.
  7. A – Auto.ස්වයංක්‍රීය.
  8. D – Memo.Memo.
  9. B – 255 characters.අක්ෂර 255.
  10. A – 3 characters.අක්ෂර 3.
  11. C – Byte.Byte.
  12. C – Purpose first.අරමුණ පළමුව.
  13. B – Accession number.Accession අංකය.
  14. D – VARCHAR.VARCHAR.
  15. C – Responsible AI.වගකීම් සහිත AI.

Structured Questionsව්‍යුහගත ප්‍රශ්න

1Plan a table tblStudent: give five field names with a suitable data type for each. (5 marks)tblStudent table එකක් සැලසුම් කරන්න: fields පහක් සහ එක් එකට සුදුසු data type එකක් දෙන්න. (ලකුණු 5) (5 marksලකුණු 5)

Show model answerආදර්ශ පිළිතුර පෙන්වන්න
AdmNo – Number; StudentName – Short Text; ClassID – Short Text; DateOfBirth – Date/Time; ICTMarks – Number (or Prefect – Yes/No).AdmNo – Number; StudentName – Short Text; ClassID – Short Text; DateOfBirth – Date/Time; ICTMarks – Number (හෝ Prefect – Yes/No).
tblStudent – Design View (MS Access)Table Design: 🔑 Primary Key Builder Test Validation Rules Insert Rows Delete RowsField NameData TypeDescription (optional)🔑AdmNoNumberAdmission number (primary key)StudentNameShort TextFull nameClassIDShort TextClass (foreign key → tblClass)DateOfBirthDate/TimeDate of birthICTMarksNumberTerm test mark out of 100PrefectYes/NoIs the student a prefect?Field Properties – StudentName (General tab)Field Size40FormatInput MaskCaptionStudent nameDefault ValueValidation RuleRequired: Yes · Indexed: Yes (No Duplicates) for the primary key
Model answerආදර්ශ පිළිතුර

2(i) What is field size? (1 mark)
(ii) Suggest a field size for ClassID and for StudentName. (2 marks)
(i) Field size යනු කුමක්ද? (ලකුණු 1)
(ii) ClassID සහ StudentName සඳහා field size යෝජනා කරන්න. (ලකුණු 2)
(3 marksලකුණු 3)

Show model answerආදර්ශ පිළිතුර පෙන්වන්න
(i) The maximum length/range of data a field can hold. (ii) ClassID – 3; StudentName – 40.(i) Field එකකට රඳවා ගත හැකි දත්තවල උපරිම දිග/පරාසය. (ii) ClassID – 3; StudentName – 40.

3Explain why NIC number should not be a Number field. (2 marks)NIC අංකය Number field එකක් නොවිය යුත්තේ ඇයි? (ලකුණු 2) (2 marksලකුණු 2)

Show model answerආදර්ශ පිළිතුර පෙන්වන්න
It is not used in calculations, old NICs contain the letter V/X (e.g. 951234567V), and leading zeros must be kept – so Short Text.එය ගණනයට නොගනී, පැරණි NIC වල V/X අකුර ඇත (උදා 951234567V), මුල බිංදු රැකිය යුතුය – එබැවින් Short Text.

4Name the data types for: (a) Price (b) Returned (c) BorrowID (d) DateBorrowed. (4 marks)පහත සඳහා data types නම් කරන්න: (a) Price (b) Returned (c) BorrowID (d) DateBorrowed. (ලකුණු 4) (4 marksලකුණු 4)

Show model answerආදර්ශ පිළිතුර පෙන්වන්න
(a) Currency (b) Yes/No (c) AutoNumber (d) Date/Time.(a) Currency (b) Yes/No (c) AutoNumber (d) Date/Time.

5State three steps to plan a single table before using a DBMS. (3 marks)DBMS එකක් භාවිතයට පෙර තනි table එකක් සැලසුම් කිරීමේ පියවර තුනක් සඳහන් කරන්න. (ලකුණු 3) (3 marksලකුණු 3)

Show model answerආදර්ශ පිළිතුර පෙන්වන්න
Decide the purpose; choose field names and the unique field; choose data types and field sizes (and test with sample data).අරමුණ තීරණය; field names සහ අනන්‍ය field තේරීම; data types සහ field sizes තේරීම (නියැදි දත්තවලින් පරීක්ෂාව).

🎮 Game🎮 ක්‍රීඩා

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

Summary & Downloadsසාරාංශය සහ බාගත කිරීම්

Key pointsප්‍රධාන කරුණු

  • Plan on paper first: purpose, fields, key, types, sizes.පළමුව කඩදාසි මත සැලසුම්: අරමුණ, fields, key, types, sizes.
  • Short Text ≤ 255 chars; Long Text for remarks.Short Text ≤ අක්ෂර 255; සටහන් සඳහා Long Text.
  • Number for calculations; Currency for money.ගණනයට Number; මුදල්වලට Currency.
  • Date/Time for dates; Yes/No for two values.දිනවලට Date/Time; අගයන් දෙකකට Yes/No.
  • AutoNumber gives unique numbers automatically.AutoNumber ස්වයංක්‍රීයව අනන්‍ය අංක දෙයි.
  • Phone and NIC numbers → Short Text.දුරකථන සහ NIC අංක → Short Text.
  • Field size: text length or Byte/Integer/Long Integer.Field size: පෙළ දිග හෝ Byte/Integer/Long Integer.
  • Check AI suggestions; never share real personal data.AI යෝජනා පරීක්ෂා කරන්න; සැබෑ පුද්ගලික දත්ත බෙදා නොගන්න.

Downloadsබාගත කිරීම්

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

Next noteඊළඟ සටහන 9.3 →

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