← VCE Data Analysis

Field data types in a database table

A setting on a database field that decides what kind of value it accepts, such as text, integer, date or yes/no, so wrong entries are rejected. It is a first form of validation.

Understanding Field data types in a database table in VCE Data Analysis

What it does: TEXT is the data type for names and other words. It accepts letters, so it suits fields like a name. BOOLEAN only allows two values (true or false, yes or no), so it is the right type for a yes/no question. A Date type only accepts valid dates, so 2009-13-45 would be rejected. It also lets you sort and compare dates correctly. Phone numbers are not used for maths, and an integer would drop the leading zero. Text keeps the number exactly as typed. The data type check fails because 'abc' is not a whole number. Rejecting wrong entries is how a data type acts as validation.

Common mistakes: Age is a whole number, so the field should be INTEGER. With TEXT, entries like 'abc' would be accepted and the validation is lost. TABLE is misspelt as TABEL. The line should be CREATE TABLE Event ( so the data types for each field can be defined.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 15–24) and word search (Modules 3–24).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
A field called Age in a student table should store whole numbers like 15. Which data type fits best?
TextInteger
Matches
phone INTEGER
↓
Phone numbers often start with 0 and are not used for maths, so INTEGER would drop the leading 0. TEXT is the better type.
Applying
Meanings
Term
data type
Meaning
A setting on a database field that decides what kind of value it accepts, such as text, integer, date or yes/no, so wrong entries are rejected. It is a first form of validation.
Practice
CREATE TABLE Students (
Testing
Gaps
name , age INTEGER
Check Answer
Spots
2 Name TEXT,
3 Age TEXT,

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Sperm Whale' badge — Deep Sea Champion, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. A field called Age in a student table should store whole numbers like 15. Which data type fits best?
A. Integer ✓
B. Text
Integer stores whole numbers only, so a value like 'fifteen' would be rejected. That makes the data type a first form of validation.
2. Which statement about a data type on a field is true?
A. It decides how many rows the table can have
B. It decides what kind of value the field accepts ✓
A data type controls the kind of value allowed in a field (text, integer, date, yes/no). It does not limit the number of rows.
3. A field called BirthDate should store 2009-03-14. Which data type is the best choice?
A. Date ✓
B. Integer
A Date type only accepts valid dates, so 2009-13-45 would be rejected. It also lets you sort and compare dates correctly.
4. A field called HasPermissionSlip only needs to record yes or no. Which data type suits it?
A. Boolean (yes/no) ✓
B. Date
A boolean field holds only two values, true/false or yes/no. This stops entries like 'maybe' being saved.
5. Which field is the better fit for the Text data type?
A. NumberOfSiblings, because it stores a count like 2
B. LastName, because it stores letters like 'Nguyen' ✓
Names are words, so text suits them. A count of siblings is a whole number, so it should be an integer.

Match the Pairs

age INTEGER → The age field only accepts whole numbers, so a value like 'fifteen' or 15.5 is rejected.
birthdate DATE → The birthdate field only accepts a real calendar date, so '31/02/2010' or 'banana' is rejected.
A field that stores words and letters, such as a student's name, should use a text type. → name TEXT
A yes/no field, such as whether a student has paid an excursion fee, should use a boolean type. → paid BOOLEAN
phone INTEGER → Phone numbers often start with 0 and are not used for maths, so INTEGER would drop the leading 0. TEXT is the better type.
price TEXT → A price is a number you may add up or compare, so it should use a number type such as DECIMAL, not TEXT.

Key Term

data type
A setting on a database field that decides what kind of value it accepts, such as text, integer, date or yes/no, so wrong entries are rejected. It is a first form of validation.

Fill in the Blanks

1. CREATE TABLE Pet ( name TEXT, age INTEGER );
Hint: Type the data type for a field that holds words, such as a pet's name.
2. CREATE TABLE Pet ( name TEXT, age INTEGER );
Hint: Type the data type for whole numbers with no decimal part, such as an age.
3. CREATE TABLE Member ( birthday DATE, name TEXT );
Hint: Type the data type that only accepts calendar dates.
4. CREATE TABLE Member ( paid BOOLEAN, name TEXT );
Hint: Type the data type for a yes/no (true or false) field.
5. CREATE TABLE Contact ( phone TEXT, name TEXT );
Hint: Phone numbers start with a zero that must be kept, so type the data type that stores characters, not a number.

Spot the Error

Question 1
A CREATE TABLE Student (
B Name TEXT,
C Age TEXT,
D Enrolled BOOLEAN
E );
Line C — Age is a whole number, so the field should be INTEGER. With TEXT, entries like 'abc' would be accepted and the validation is lost.
Question 2
A CREATE TABEL Event (
B Title TEXT,
C EventDate DATE,
D Cost DECIMAL(5,2)
E );
Line A — TABLE is misspelt as TABEL. The line should be CREATE TABLE Event ( so the data types for each field can be defined.
Question 3
A CREATE TABLE Pet (
B Name INTEGER,
C Age INTEGER,
D Vaccinated BOOLEAN
E );
Line B — A pet's name is made of letters, so it needs the TEXT data type. INTEGER only accepts whole numbers and would reject names like Milo.
Question 4
A CREATE TABLE Book (
B Title TEXT,
C Pages INTEGER,
D Borrowed DATE
E );
Line D — Borrowed is a yes/no value, so its type should be BOOLEAN. A DATE field would only accept dates, not true or false.
Question 5
A INSERT INTO Pet (Name, Age)
B VALUES ('Milo', 'three');
C -- Age is an INTEGER field
Line B — Age is an INTEGER field, so the value must be the number 3, not the text 'three'. The database would reject the text. It should be VALUES ('Milo', 3);

Student with a class code? Join your class →