← VCE Data Analytics U3O1

Field sizes

Field size sets the maximum length or storage a value may use. VARCHAR(30) allows up to 30 characters; longer values are rejected or cut. Smaller sizes save storage.

Understanding Field sizes in VCE Data Analytics U3O1

What it does: VARCHAR(3) limits the field to 3 characters, enough for codes like VIC or NSW and no storage is wasted. TINYINT uses less storage than INT, so choosing it for small values like year levels saves space. The size in brackets sets the maximum length of the text. It is not the value itself. Choose a size that fits the longest expected value. A smaller size saves storage and matches the data. A value longer than the field size is rejected or cut. The field does not resize. SQL puts the size in round brackets straight after the data type, like VARCHAR(50).

Common mistakes: The field size must go in round brackets, not square brackets. It should be VARCHAR(30). The opening bracket is missing. The field definitions, including their sizes such as VARCHAR(50), must start after CREATE TABLE products (.

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 17–49) and word search (Modules 17–91).

Take this worksheet further — free with Cloodit

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

Learning
Duo
A field is set as VARCHAR(30). What does the 30 mean?
The value must be the number 30The value can be up to 30 characters long
Matches
INSERT INTO students (house) VALUES ('Burgundy Dragons'); -- house VARCHAR(5)
↓
The value has 16 characters but the field size only allows 5, so it will be rejected or cut off.
Applying
Meanings
Term
VARCHAR(30)
Meaning
Field size sets the maximum length or storage a value may use. VARCHAR(30) allows up to 30 characters; longer values are rejected or cut. Smaller sizes save storage.
Practice
CREATE TABLE clubMembers (
Testing
Gaps
firstName (30)
Check Answer
Spots
2 studentId INT,
3 firstName VARCHAR[30],

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

The 'Chambered Nautilus' badge — File Explorer, 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 is set as VARCHAR(30). What does the 30 mean?
A. The value can be up to 30 characters long ✓
B. The value must be the number 30
The size in brackets sets the maximum length of the text. It is not the value itself.
2. A State field holds values like 'VIC' and 'NSW'. Which size fits best?
A. VARCHAR(3) ✓
B. VARCHAR(255)
Choose a size that fits the longest expected value. A smaller size saves storage and matches the data.
3. A field is VARCHAR(10). A user enters 'Christopher' (11 characters). What can happen?
A. The field grows automatically to fit it
B. The value is rejected or cut off to fit ✓
A value longer than the field size is rejected or cut. The field does not resize.
4. Which statement about field sizes is true?
A. Every field should use the largest possible size
B. Smaller field sizes save storage space ✓
Oversized fields waste storage across thousands of records. Pick a size that suits the data.
5. Which field definition sets a maximum text length of 50 characters?
A. LastName VARCHAR(50) ✓
B. LastName VARCHAR[50 characters]
SQL puts the size in round brackets straight after the data type, like VARCHAR(50).

Match the Pairs

firstName VARCHAR(30) → The firstName field can store text up to a maximum of 30 characters
postcode CHAR(4) → The postcode field is set to a size of exactly 4 characters
A field size sets the maximum length of text a value may use, so a short code only needs a small size → stateCode VARCHAR(3)
A smaller field size saves storage, so a field holding a small whole number can use a small number type → yearLevel TINYINT
INSERT INTO students (house) VALUES ('Burgundy Dragons'); -- house VARCHAR(5) → The value has 16 characters but the field size only allows 5, so it will be rejected or cut off.
email VARCHAR(10) → A size of 10 is too small for most email addresses, so many values would be rejected or cut off.

Key Term

VARCHAR(30)
Field size sets the maximum length or storage a value may use. VARCHAR(30) allows up to 30 characters; longer values are rejected or cut. Smaller sizes save storage.

Fill in the Blanks

1. -- Text of varying length, max 30 firstName VARCHAR(30)
Hint: Type the SQL data type for text that can vary in length up to a set maximum.
2. -- Names may be up to 30 characters firstName VARCHAR(30)
Hint: Type the field size that matches the maximum number of characters in the comment.
3. -- State code, always 3 characters state CHAR(3)
Hint: Type the field size that fits the fixed length of the state code.
4. -- Australian postcodes have 4 digits postcode CHAR(4)
Hint: Type the field size that fits the number of characters in a postcode.
5. -- 6 digits in total, 2 after the point price DECIMAL(6,2)
Hint: Type the number size: the total digits this number field can store.

Spot the Error

Question 1
A CREATE TABLE students (
B studentId INT,
C firstName VARCHAR[30],
D house VARCHAR(10)
E );
Line C — The field size must go in round brackets, not square brackets. It should be VARCHAR(30).
Question 2
A CREATE TABLE products
B name VARCHAR(50),
C price DECIMAL(6,2)
D );
Line A — The opening bracket is missing. The field definitions, including their sizes such as VARCHAR(50), must start after CREATE TABLE products (
Question 3
A postcode CHAR(four),
B suburb VARCHAR(40),
C state CHAR(3)
Line A — A field size must be a number inside the brackets. It should be CHAR(4).
Question 4
A -- Houses: Red, Blue, Green
B -- Longest name: 5 characters
C house VARCHAR(3)
Line C — 'Green' has 5 characters, so a size of 3 would reject it or cut it to 'Gre'. The size should be VARCHAR(5).
Question 5
A -- Smaller sizes save storage
B -- Choose smallest size needed
C -- Y/N flag needs 1 character
D member CHAR(255)
Line D — A Y/N flag needs only 1 character. A size of 255 wastes storage. It should be CHAR(1).

Student with a class code? Join your class →