Skill

3.7.2 SQL insert, update and delete

GCSE Computer Science AQA

This resource focuses on 3.7.2 SQL insert, update and delete within AQA GCSE Computer Science. Students need more than vague familiarity here. They need to recognise what each command does, write valid syntax, and spot when a query would change the wrong records. In the specification, this sits within relational databases and structured query language, so it connects directly to tables, fields, records, and the practical management of stored data.

For teaching, the challenge is usually not the basic idea of adding, editing, or removing data. It is the precision. One missing quote or one absent WHERE, and suddenly the whole table has had a very bad lesson. This page gives you a classroom-ready guide to the exact knowledge students need, along with practical marking guidance so you can reward secure understanding rather than lucky syntax.


At a Glance

๐Ÿงญ Specification context

  • This topic sits within AQA GCSE Computer Science 3.7.2 Structured query language (SQL).

  • The focus here is on commands that change data in a relational database.

  • Students are expected to understand the purpose and syntax of INSERT, UPDATE, and DELETE.

Students must know

  • how INSERT INTO ... VALUES ... adds a new record

  • how UPDATE ... SET ... WHERE ... changes existing data

  • how DELETE FROM ... WHERE ... removes records

  • why WHERE matters when only specific records should be changed

Common exam focus

  • writing correct SQL syntax

  • identifying the effect of a command

  • spotting unsafe queries that would affect too many records

Typical student challenges

  • confusing fields with records

  • forgetting WHERE in UPDATE or DELETE

  • mixing up INSERT INTO and UPDATE

  • mismatching field names, values, quotes, or brackets


Understanding the Topic

SQL is used to work with data stored in relational database tables. In this part of the AQA course, students need to understand how data is added, changed, and removed. The command matters because each one performs a different job, and exam questions often hinge on that difference.

INSERT INTO

Use INSERT INTO when a new record needs to be added to a table.

INSERT INTO Students (StudentID, Name, Grade)
VALUES (1042, 'Amira Khan', 'B')

Teachers should stress that:

  • the table name must be correct
  • the field list and value list must match in number and order
  • this command creates a new row, not an edit to an existing one

UPDATE

Use UPDATE when data in an existing record needs to be changed.

UPDATE Students
SET Grade = 'A'
WHERE StudentID = 1042

Teachers should stress that:

  • SET identifies the field or fields being changed
  • WHERE identifies which record or records should be changed
  • if WHERE is omitted, every record in the table may be updated

DELETE

Use DELETE when one or more existing records need to be removed.

DELETE FROM Students
WHERE StudentID = 1042

Teachers should stress that:

  • DELETE FROM removes whole records, not single field values
  • WHERE is essential when the question is targeting a specific record
  • without WHERE, the query may remove all records from the table

What students need to secure

  • the difference between new data and existing data
  • the relationship between table names, field names, and values
  • the effect of a condition in WHERE
  • the idea that SQL must be precise, even when the command itself looks familiar

๐Ÿ’ก Teacher tip
Have students read each line of a query aloud in plain English.

  • UPDATE Students means which table?

  • SET Grade = 'A' means what changes?

  • WHERE StudentID = 1042 means which record only?

This slows the syntax down just enough to stop guesswork.


Key Terms and Concepts

Term Explanation
SQL Structured Query Language, used to query and manage data in a relational database.
Table A collection of related data arranged in rows and columns.
Record A single row in a table.
Field A column in a table that stores one type of data.
INSERT INTO The command used to add a new record to a table.
VALUES The clause that supplies the data to be inserted.
UPDATE The command used to change data already stored in a table.
SET The clause used with UPDATE to name the field or fields that will change.
DELETE FROM The command used to remove one or more records from a table.
WHERE The clause that limits a command to records matching a condition.
Condition A test used in WHERE to decide which record or records are affected.

How to Teach This Topic

Suggested teaching sequence

  1. Start with a visible paper table or projected table.
  2. Ask students whether the task is to add, change, or remove data.
  3. Match each action to the correct SQL command.
  4. Model one complete example at a time.
  5. Finish with "What would happen if WHERE were missing?" checks.

Classroom moves that work well

  • colour-code table name, field name, value, and condition
  • get students to annotate queries with "does what?" notes above each line
  • use mini whiteboards for quick syntax corrections
  • give students broken queries and ask them to repair them
  • contrast two near-identical commands so students must explain the difference

Discussion prompts and scaffolds

  • Which command would you use if the record already exists?
  • Which part of the query tells the database where to look?
  • What is the risk of leaving out WHERE?
  • Is this command changing one field or removing the whole record?
  • Can students translate the SQL into plain English before writing their own?

Scaffolding ideas

  • give sentence frames such as "To add a new record, I start with..."
  • provide a table diagram beside every first attempt
  • keep field names short at first, then increase complexity
  • use sorting cards with command parts that students assemble into a correct query

Extension activities

  • ask students to correct queries containing more than one mistake
  • give a database scenario and ask students to choose between INSERT, UPDATE, and DELETE
  • challenge students to explain why two commands with similar wording would have different effects

๐Ÿงช Useful classroom check
If a student can explain why UPDATE is wrong for a new record and why INSERT INTO is wrong for an existing one, understanding is usually much more secure.


How to Mark This Topic Effectively

When marking SQL responses, reward the right command for the task first. After that, look for precise control over the table, field, value, and condition.

Strong answers usually

  • choose the correct command immediately
  • name the correct table
  • use the correct field name in SET or the field list in INSERT INTO
  • use values in a sensible order
  • include WHERE when a specific record is targeted
  • show that the student understands the effect of the query

Weaker answers often

  • use INSERT INTO when the question asks to edit existing data
  • forget FROM after DELETE
  • miss out the field name after SET
  • omit WHERE and accidentally affect every record
  • copy field names inaccurately from the question
  • confuse removing a record with clearing a field value
What to reward What to watch carefully
Correct command selection for the scenario A correct-looking query that performs the wrong task
Accurate table and field names Invented or altered field names
Secure use of SET, VALUES, and WHERE Missing clauses that make the query unsafe or incomplete
Awareness of the effect of the query Answers that appear memorised but are not understood

๐Ÿ“ Exam technique reminder
If the question identifies one named record, a missing WHERE should normally lose credit for control and accuracy, even if the rest of the command is correct. It is the database equivalent of writing the right answer in the wrong box.


Example Student Responses

Example question

Write an SQL statement to change the Grade of the student with StudentID = 1042 to B. [4 marks]

Marking guidelines

Mark point What earns the mark
1 Uses UPDATE with the correct table name
2 Uses SET Grade = 'B' or equivalent correct field and value
3 Uses a correct WHERE clause targeting StudentID = 1042
4 Produces a complete query with the correct overall structure
Strong response
UPDATE Students
SET Grade = 'B'
WHERE StudentID = 1042
  • Award: 4/4
  • The student has selected the correct command for editing existing data.
  • The field being changed is identified accurately.
  • The WHERE clause limits the change to the correct record.
  • This is precise, safe, and fully aligned with the task.
Weak response
UPDATE Students
SET Grade = 'B'
  • Award: 2-3/4, depending on the mark scheme wording used in class.
  • Reward the correct command and the correct field/value change.
  • Do not award full credit because the missing WHERE means every record in the table could be changed.
  • This is a very common near-miss and worth flagging explicitly in feedback.

Practice Questions

  1. A table called Books has the fields BookID, Title, and Author. Write an SQL statement to add a new book with the values 301, 'Code Breakers', and 'T Patel'. [3 marks]
    • Marking guidelines: reward correct use of INSERT INTO, a correct field list, and a correct VALUES list in matching order.
  2. A table called Students includes the fields StudentID and House. Write an SQL statement to change the House of the student with StudentID = 2005 to 'Red'. [4 marks]
    • Marking guidelines: reward correct use of UPDATE, SET, the new value, and a correct WHERE clause.
  3. A table called Orders contains a record with OrderID = 8801 that should be removed. Write the SQL statement needed. [4 marks]
    • Marking guidelines: reward correct use of DELETE FROM, the correct table name, and a WHERE clause targeting the correct record. Penalise omission of WHERE.
  4. Explain why WHERE is important when using UPDATE or DELETE. [2 marks]
    • Marking guidelines: credit answers that explain it identifies which record or records are affected and prevents all records from being changed or deleted.
  5. A student writes INSERT INTO Students SET Grade = 'A'. Explain what is wrong with this command. [3 marks]
    • Marking guidelines: reward recognition that INSERT INTO is used to add a new record, SET belongs with UPDATE, and the command structure does not match the task.

Common Misconceptions

  • UPDATE adds a new record.
    • Quick correction: UPDATE changes existing data. INSERT INTO adds new data.
  • DELETE removes one field value.
    • Quick correction: DELETE FROM removes the whole record that matches the condition.
  • WHERE is just extra detail.
    • Quick correction: WHERE controls which record is affected. Without it, the whole table may be changed.
  • Field names and values can be swapped around freely.
    • Quick correction: field names identify where the data goes. Values are the actual data being inserted or used.
  • If the SQL looks familiar, it is probably fine.
    • Quick correction: exam questions reward exact syntax and correct effect, not close-enough guesses.

FAQ

Do students need to memorise the exact SQL syntax?

Yes. Students should be able to recognise and write the standard structure for INSERT INTO, UPDATE, and DELETE. Minor variations may exist in real systems, but GCSE questions reward secure use of the expected command pattern.

Should students always use `WHERE` with `UPDATE` and `DELETE`?

If the task targets specific data, yes. In exam questions, omitting WHERE is usually a strong sign that the student does not understand how the query controls which records are affected.

Do students lose marks for incorrect capital letters in SQL?

Capital letters usually improve readability, but accuracy of the command structure matters more than styling. A correct lower-case answer is still showing the right understanding unless your classroom routine says otherwise.

How can I help students stop mixing up `INSERT INTO` and `UPDATE`?

Keep returning to the same decision question: Is this a new record or an existing one? If students answer that first, they are much more likely to choose the correct command.

What is the best way to check whether students really understand the query?

Ask students to describe the effect of the query in plain English. If they can explain exactly what would happen to the table, they usually understand the syntax well enough to use it accurately.


Save time on the marking that follows

โœ… Marking.ai helps teachers move from practice response to feedback much faster, without losing clarity.

  • spot recurring SQL misconceptions across a class

  • keep feedback consistent on syntax and exam technique

  • spend less time decoding answers and more time improving them