← VCE Data Analytics U3O1

SQL column data types and sizes

A column's data type and size set in CREATE TABLE. VARCHAR(50) holds text up to 50 characters. Other types: INT, DECIMAL(8,2), DATE, BOOLEAN. They control what a column stores.

Understanding SQL column data types and sizes in VCE Data Analytics U3O1

What it does: INT holds whole numbers with no decimal part, so it suits counts, ages and scores. The DATE type is used for calendar dates, so the database can sort and compare them correctly. VARCHAR(n) stores text up to n characters. INT only stores whole numbers, so it cannot hold names. In DECIMAL(p,s), p is the total number of digits and s is the number of digits after the decimal point. It is ideal for prices like 4.50. INT would drop the cents. DECIMAL(8,2) keeps two decimal places. VARCHAR needs a size in brackets, such as VARCHAR(10), so the database knows the maximum number of characters.

Common mistakes: VARCHAR must have a size in brackets to say the maximum number of characters. It should be VARCHAR(50). DECIMAL takes two numbers separated by a comma: precision and scale. It should be DECIMAL(6,2), not DECIMAL(6.2).

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
Which column type is best for a student's first name?
firstName VARCHAR(50)firstName INT
Matches
lastName VARCHAR
↓
VARCHAR has no size. A maximum number of characters is needed, for example VARCHAR(50).
Applying
Meanings
Term
VARCHAR(50)
Meaning
A column's data type and size set in CREATE TABLE. VARCHAR(50) holds text up to 50 characters. Other types: INT, DECIMAL(8,2), DATE, BOOLEAN. They control what a column stores.
Practice
CREATE TABLE club (
Testing
Gaps
firstName (50)
Check Answer
Spots
1CREATE TABLE Student (
2 firstName VARCHAR,

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

The 'Barreleye Fish' badge — Clear Vision, 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. Which column type is best for a student's first name?
A. firstName INT
B. firstName VARCHAR(50) ✓
VARCHAR(n) stores text up to n characters. INT only stores whole numbers, so it cannot hold names.
2. Which column type is best for a whole-number count such as stock?
A. stock INT ✓
B. stock DATE
INT stores whole numbers like 200 or 80. DATE is only for calendar dates.
3. What does the (8,2) mean in DECIMAL(8,2)?
A. 8 characters of text, and 2 rows allowed
B. Up to 8 digits in total, with 2 after the decimal point ✓
In DECIMAL(p,s), p is the total number of digits and s is the number of digits after the decimal point. It is ideal for prices like 4.50.
4. Which is the correct way to declare a price column that stores values like 12.50?
A. price DECIMAL(8,2) ✓
B. price INT
INT would drop the cents. DECIMAL(8,2) keeps two decimal places.
5. Which column is declared with a sensible type for an order date?
A. orderDate DATE ✓
B. orderDate BOOLEAN
DATE stores calendar dates such as 2026-02-03. BOOLEAN only stores true or false.

Match the Pairs

firstName VARCHAR(50) → A text column that can hold up to 50 characters
price DECIMAL(8,2) → A number column with up to 8 digits in total, 2 of them after the decimal point
A column that stores whole numbers only, such as a student's age or points → points INT
A column that stores a calendar date such as a birth date or order date → orderDate DATE
lastName VARCHAR → VARCHAR has no size. A maximum number of characters is needed, for example VARCHAR(50).
inStock INT → INT stores whole numbers, so it is the wrong type for a true/false value. BOOLEAN should be used.

Key Term

VARCHAR(50)
A column's data type and size set in CREATE TABLE. VARCHAR(50) holds text up to 50 characters. Other types: INT, DECIMAL(8,2), DATE, BOOLEAN. They control what a column stores.

Fill in the Blanks

1. CREATE TABLE students ( firstName VARCHAR(50) );
Hint: Type the data type used for text of varying length.
2. CREATE TABLE products ( stock INT );
Hint: Type the data type for whole numbers.
3. CREATE TABLE products ( price DECIMAL(8,2) );
Hint: Type the number of digits kept after the decimal point (the scale).
4. CREATE TABLE orders ( orderDate DATE );
Hint: Type the data type for calendar dates.
5. CREATE TABLE students ( isPrefect BOOLEAN );
Hint: Type the data type for a true or false value.

Spot the Error

Question 1
A CREATE TABLE Student (
B firstName VARCHAR,
C yearLevel INT,
D house VARCHAR(10)
E );
Line B — VARCHAR must have a size in brackets to say the maximum number of characters. It should be VARCHAR(50).
Question 2
A CREATE TABLE Product (
B productId INT,
C name VARCHAR(40),
D price DECIMAL(6.2),
E stock INT
F );
Line D — DECIMAL takes two numbers separated by a comma: precision and scale. It should be DECIMAL(6,2), not DECIMAL(6.2).
Question 3
A CREATE Orders TABLE (
B orderId INT,
C orderDate DATE
D );
Line A — The SQL keywords are in the wrong order. It should be CREATE TABLE Orders ( with the table name after TABLE.
Question 4
A CREATE TABLE Event
B eventName VARCHAR(30),
C eventDate DATE,
D isPublic BOOLEAN
E );
Line A — The column definitions must start inside an opening bracket. The line should end with ( so it reads CREATE TABLE Event (
Question 5
A CREATE TABLE Staff (
B staffId INT,
C hireDate DATE(10),
D salary DECIMAL(8,2)
E );
Line C — The DATE type has a fixed format and does not take a size. It should be just DATE.

Student with a class code? Join your class →