Choose text and character data types
Use text or alphanumeric data for labels and codes, and CHAR when a field contains one character.
Exam scope and assessment notes
This sequence follows Cambridge IGCSE Computer Science 0478, 2026–2028 syllabus Version 6, Topic 9. It covers single-table databases only and the specified SELECT, FROM, WHERE, ORDER BY, SUM, COUNT, AND and OR content. The official specimen also demonstrates NOT in a filter. Multi-table joins, GROUP BY, database implementation and the separate 2029–2031 syllabus are not mapped here. Practice is original, self-checked and does not award an official Cambridge grade. Full timed papers and human subject-teacher review remain outstanding.
Before you begin
- Be able to read a small table and compare values. Each lesson introduces the database and SQL terms it uses.
Work on paper. Try each question before revealing help, and explain why your method works.
Quick readiness check
Which type best fits a field that contains a full surname?
What you will learn
- Distinguish alphanumeric text from a single character
- Preserve leading zeros and letters in codes
- Choose a type that matches how the value is used
Text keeps symbols and letters together
Text or alphanumeric fields store names, labels and codes that may contain letters, digits or punctuation. Examples include a learner name, room label or code such as 0047A.
A code is not automatically a number just because it contains digits. If arithmetic is never performed and leading zeros matter, store it as text.
CHAR stores one character
Use a character type when exactly one character is required, such as a grade letter or a single initial.
If the value may contain several characters, use text instead. Match the type to the maximum intended content and how the program uses the field.
Pause and explain
A centre code is 0072 and is never used in arithmetic. Which choice is safest?
Worked example
Choose types for a learner name, a product code 0031X and a one-letter grade.
Show the worked solution
- The name contains several characters.
- The product code mixes digits and a letter, and its zero prefix matters.
- The grade contains one character.
Answer LearnerName: text/alphanumeric; ProductCode: text/alphanumeric; Grade: character.
Try a topic test
Choose Easy, Normal or Difficult. Save your answers and open worked review after finishing.
Test this topic →From guided practice to a new situation
Write your answer and reasoning first. Use a hint only if you are stuck. The model solution is for self-checking; your written work is not automatically marked.
Choose between character and text for a field that holds either A or B.
Give me a hint
The field always stores exactly one symbol.
Compare my reasoning
- There are only two possible letters.
- Each value contains one character.
- CHAR is suitable.
Use a character type because every value is exactly one character.
Look for these in your work
- Length recognised
- Type selected
A bus route code is M07. Explain why it should be text rather than an integer.
Give me a hint
Consider whether the value is calculated or identified.
Compare my reasoning
- The code contains a letter.
- The initial zero is meaningful.
- Text preserves the code exactly as shown.
Use text because it contains a letter and identifies a route; it is not a number to calculate with.
Look for these in your work
- Content assessed
- Identifier role
A field called Initial stores the first letter of a person's name, while FullName stores the whole name. Choose a type for each.
Give me a hint
Check the expected number of characters.
Compare my reasoning
- Initial contains one character.
- FullName contains multiple characters.
- Use distinct types to match the two field shapes.
Initial: character; FullName: text/alphanumeric.
Look for these in your work
- Single character type
- Multiple-character type
Common mistakes
- Storing a code as an integer and losing leading zeros
- Using CHAR for a full name
- Assuming digits always mean arithmetic data
What can you explain now?
Why is text suitable for code 0031X?
Compare with the explanation
It can preserve letters and leading zeros
The value is an identifier, not a quantity for calculation.
After trying it yourself, choose your next review. This is your self-assessment.
Your review choice appears on Today. Sign in to sync it across devices.
Make it stick
When should a digit-containing value be stored as text?
If you needed the solution, close it and solve the problem again from a blank page. A correct answer is stronger when you can explain the reason for each step.