© 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
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 එකක් සකසන්න.
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 Base | Storesගබඩා කරන්නේ | School exampleපාසල් උදාහරණය |
|---|---|---|---|
| Short TextShort Text | Text [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ගුරු සටහන් |
| NumberNumber | Integer / DecimalInteger / Decimal | Numbers used in calculationsගණනයට භාවිත කරන අංක | ICTMarks, Copies, RoomICTMarks, Copies, Room |
| Date/TimeDate/Time | DateDate | Dates and timesදින සහ වේලාවන් | DateOfBirth, DateBorrowedDateOfBirth, DateBorrowed |
| CurrencyCurrency | Decimal (Currency format)Decimal (Currency format) | Money values (Rs.)මුදල් අගයන් (රු.) | Book Price, facility feeපොතේ මිල, පහසුකම් ගාස්තුව |
| Yes/NoYes/No | Yes/No [BOOLEAN]Yes/No [BOOLEAN] | Only two values: Yes/No, True/Falseඅගයන් දෙකක් පමණි: Yes/No, True/False | Prefect, ReturnedPrefect, Returned |
| AutoNumberAutoNumber | Integer + AutoValueInteger + AutoValue | A number added automatically (1, 2, 3 …), uniqueස්වයංක්රීයව එකතු වන අනන්ය අංකයක් (1, 2, 3 …) | BorrowIDBorrowID |
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 name | Data typeData type | Field sizeField size | Descriptionවිස්තරය |
|---|---|---|---|
| BookIDBookID | Short TextShort Text | 44 | Accession number, e.g. B001 (primary key)Accession number, e.g. B001 (primary key) |
| TitleTitle | Short TextShort Text | 6060 | Book titleBook title |
| AuthorAuthor | Short TextShort Text | 4040 | AuthorAuthor |
| CategoryCategory | Short TextShort Text | 1515 | Novel, Reference …Novel, Reference … |
| PricePrice | CurrencyCurrency | Rs.Rs. | Price in rupeesPrice in rupees |
| CopiesCopies | NumberNumber | IntegerInteger | Copies in the libraryCopies in the library |
Key Wordsප්රධාන පද
Sample Q&Aආදර්ශ ප්රශ්න සහ පිළිතුරු
1List the steps in planning a table.Table එකක් සැලසුම් කිරීමේ පියවර ලැයිස්තු කරන්න.
2Which data type is used for a book’s price?පොතක මිල සඳහා භාවිත කරන data type එක කුමක්ද?
3Why is a phone number stored as Short Text?දුරකථන අංකයක් Short Text ලෙස ගබඩා කරන්නේ ඇයි?
4Give a field suitable for Yes/No.Yes/No ට සුදුසු field එකක් දෙන්න.
5What is field size for a Short Text field?Short Text field එකක field size යනු කුමක්ද?
6What does AutoNumber do?AutoNumber කරන්නේ කුමක්ද?
MCQබහුවරණ ප්රශ්න
Choose the correct answer for each question.සෑම ප්රශ්නයකටම නිවැරදි පිළිතුර තෝරන්න.
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 පිළිතුරු
- B – Text.Text.
- D – Calculated.ගණනය කරයි.
- A – Money.මුදල්.
- B – Two values.අගයන් දෙකකි.
- A – Dates.දින.
- C – Keep leading 0.මුල 0 රැකීම.
- A – Auto.ස්වයංක්රීය.
- D – Memo.Memo.
- B – 255 characters.අක්ෂර 255.
- A – 3 characters.අක්ෂර 3.
- C – Byte.Byte.
- C – Purpose first.අරමුණ පළමුව.
- B – Accession number.Accession අංකය.
- D – VARCHAR.VARCHAR.
- 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ආදර්ශ පිළිතුර පෙන්වන්න
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ආදර්ශ පිළිතුර පෙන්වන්න
3Explain why NIC number should not be a Number field. (2 marks)NIC අංකය Number field එකක් නොවිය යුත්තේ ඇයි? (ලකුණු 2) (2 marksලකුණු 2)
Show model answerආදර්ශ පිළිතුර පෙන්වන්න
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ආදර්ශ පිළිතුර පෙන්වන්න
5State three steps to plan a single table before using a DBMS. (3 marks)DBMS එකක් භාවිතයට පෙර තනි table එකක් සැලසුම් කිරීමේ පියවර තුනක් සඳහන් කරන්න. (ලකුණු 3) (3 marksලකුණු 3)
Show model answerආදර්ශ පිළිතුර පෙන්වන්න
🎮 Game🎮 ක්රීඩා
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 යෝජනා පරීක්ෂා කරන්න; සැබෑ පුද්ගලික දත්ත බෙදා නොගන්න.
