Primary key
A field whose value is unique for every record in a table, such as a student ID number, so each record can be identified exactly. Names make poor keys because they can repeat.
Understanding Primary key in VCE Spreadsheets, SQL & Visualisation
What it does: AUTOINCREMENT creates a new unique number for each record, so nobody has to type IDs and risk repeating one. StudentID is declared as the primary key, so each student record can be identified exactly. A primary key must be unique for every record. If a value repeated, you could not tell which record you meant. Auto-numbering makes the database assign a new unique ID, such as 1, 2, 3, so you cannot create duplicates by accident. Many students are in the same year, so Year repeats. StudentID is different for every student. In SQL, the field name and data type come first, then the words PRIMARY KEY.
Common mistakes: The keyword is PRIMARY KEY, both words. Without KEY, the database does not mark StudentID as the unique identifier. It should be: StudentID INT PRIMARY KEY,. Auto-numbering counts up 1, 2, 3 and so on, so the field needs a number type. It should be INT, not TEXT.
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.
Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.
Over 100 of them, across seven natural biomes.
Turns their work into revision material ready for Flash Cards and Exam study.
Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.
Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.
Quick Questions
Match the Pairs
Key Term
PRIMARY KEYFill in the Blanks
Spot the Error
Student with a class code? Join your class →