← VCE Spreadsheets, SQL & Visualisation

CREATE TABLE and INSERT INTO

SQL command that builds a new table by naming its fields and their data types, such as a PRIMARY KEY. INSERT INTO ... VALUES then adds one record to that table.

Understanding CREATE TABLE and INSERT INTO in VCE Spreadsheets, SQL & Visualisation

What it does: PRIMARY KEY is written after the field's data type inside CREATE TABLE to make that field unique for each record. The number 2 has no quotes but the text 'Rex' does, matching the INT and TEXT types of the fields. The table has to exist first. Run CREATE TABLE, then use INSERT INTO to add records. The list of fields must be wrapped in brackets and separated by commas. INSERT INTO ... VALUES adds a single record, with values in the same order as the fields. The command must say CREATE TABLE so SQL knows a new table is being built.

Common mistakes: Each field definition must be separated from the next by a comma. The Name line should end with a comma: Name TEXT,. The keyword is PRIMARY KEY, two words. The line should be: ID INTEGER PRIMARY KEY,.

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 35–44) and word search (Modules 35–54).

Take this worksheet further — free with Cloodit

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

Learning
Duo
Which command builds a brand new table in a SQL database?
CREATE TABLEINSERT INTO
Matches
CREATE Students (ID INT, Name TEXT);
↓
The word TABLE is missing. It should be CREATE TABLE Students (...).
Applying
Meanings
Term
CREATE TABLE
Meaning
SQL command that builds a new table by naming its fields and their data types, such as a PRIMARY KEY. INSERT INTO ... VALUES then adds one record to that table.
Practice
CREATE TABLE Students (
Testing
Gaps
Students (
Check Answer
Spots
2 ID INTEGER PRIMARY KEY,
3 Name TEXT

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

The 'Narwhal' badge — Unicorn Coder, 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 command builds a brand new table in a SQL database?
A. CREATE TABLE ✓
B. INSERT INTO
CREATE TABLE sets up the table's structure (its fields and data types). INSERT INTO only adds records to a table that already exists.
2. Which statement adds one new record to a table called Students?
A. INSERT INTO Students VALUES (1, 'Mia', 15); ✓
B. CREATE TABLE Students VALUES (1, 'Mia', 15);
INSERT INTO ... VALUES adds a record. CREATE TABLE needs field names and data types in brackets, not values.
3. Which line correctly defines a field in a CREATE TABLE statement?
A. TEXT Name,
B. Name TEXT, ✓
Each field is written as the field name first, then its data type, for example Name TEXT.
4. What does PRIMARY KEY do when it is added to the StudentID field?
A. Makes every record's StudentID unique so each record can be identified ✓
B. Sorts the table so the biggest StudentID is always first
A primary key is a unique identifier for each record. It does not sort the table.
5. True or false: you can INSERT INTO a table before it has been created with CREATE TABLE.
A. True
B. False ✓
The table has to exist first. Run CREATE TABLE, then use INSERT INTO to add records.

Match the Pairs

CREATE TABLE Students (ID INT, Name TEXT); → Builds a new table called Students with two fields: ID that holds whole numbers and Name that holds text.
INSERT INTO Students VALUES (1, 'Mia'); → Adds one new record to the Students table with ID 1 and Name Mia.
A PRIMARY KEY field gives every record a unique ID, and it is set when the table is created. → CREATE TABLE Pets (PetID INT PRIMARY KEY, Name TEXT);
Text values are put in quotes, and numbers are not, when adding a record. → INSERT INTO Pets VALUES (2, 'Rex');
CREATE Students (ID INT, Name TEXT); → The word TABLE is missing. It should be CREATE TABLE Students (...).
INSERT INTO Students VALUES (3, Zoe); → The text value Zoe needs quotes. It should be 'Zoe'.

Key Term

CREATE TABLE
SQL command that builds a new table by naming its fields and their data types, such as a PRIMARY KEY. INSERT INTO ... VALUES then adds one record to that table.

Fill in the Blanks

1. CREATE TABLE Students ( StudentID INT PRIMARY KEY, Name TEXT);
Hint: Type the two-word SQL command that builds a new table.
2. CREATE TABLE Books ( BookID INT PRIMARY KEY, Title TEXT);
Hint: Type the keywords that make this field uniquely identify each record.
3. INSERT INTO Students (StudentID, Name) VALUES (1, 'Mia');
Hint: Type the two-word command that adds a new record to a table.
4. INSERT INTO Books (BookID, Title) VALUES (1, 'Holes');
Hint: Type the keyword that introduces the data for the new record.
5. CREATE TABLE Pets ( PetID INT PRIMARY KEY, Name TEXT);
Hint: Type the data type used for whole numbers.

Spot the Error

Question 1
A CREATE TABLE Student (
B ID INTEGER PRIMARY KEY,
C Name TEXT
D Age INTEGER
E );
Line C — Each field definition must be separated from the next by a comma. The Name line should end with a comma: Name TEXT,
Question 2
A CREATE TABLE Pet (
B ID INTEGER PRIMARY,
C Name TEXT
D );
Line B — The keyword is PRIMARY KEY, two words. The line should be: ID INTEGER PRIMARY KEY,
Question 3
A MAKE TABLE Song (
B SongID INTEGER PRIMARY KEY,
C Title TEXT
D );
Line A — SQL does not have a MAKE TABLE command. A new table is built with CREATE TABLE Song (
Question 4
A INSERT Song (ID, Title)
B VALUES (1, 'Thunder');
C SELECT * FROM Song;
Line A — The command needs the keyword INTO before the table name. It should be: INSERT INTO Song (ID, Title)
Question 5
A CREATE TABLE Game (
B ID INTEGER PRIMARY KEY,
C Title TEXT);
D INSERT INTO Game (ID Title)
E VALUES (1, 'Chess');
Line D — The field names in the brackets must be separated by a comma. It should be: INSERT INTO Game (ID, Title)

Student with a class code? Join your class →