SQL injection
An attack where SQL commands typed into an input box run because the program joins the input straight into a query. Parameterised queries stop it by treating input only as data.
Understanding SQL injection in ACARA Digital Technologies Years 9–10
What it does: Joining the name straight into the query lets the user's text change the SQL command. This is the weakness that SQL injection exploits. The command has a placeholder and the input is passed on its own. The database never runs the input as SQL. '1'='1' is always true, so the query can match every row and let the attacker log in without a real password. Code injection happens when input meant to be data gets run as commands. SQL injection is code injection aimed at a database. A smaller box does not stop commands. Parameterised queries stop the input from being treated as SQL.
Common mistakes: eval() runs whatever the user types as Python code, which is code injection. input() already gives plain text that the parameterised query can treat as data. It should be name = input("Name: "). Putting quotes around the ? turns it into the literal text '?', so no value is bound. The placeholder must stand alone: WHERE owner = ?
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 782–809) and word search (Modules 743–809).
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
SQL injectionFill in the Blanks
Spot the Error
Student with a class code? Join your class →