National 5 Computing Science
SQL UPDATE and INSERT without losing marks
National 5 Computing Science: Database design and development
Writing a statement that changes the data looks easy, but the examiners' reports say it costs marks: in 2025, UPDATE answers with the wrong structure or a missing value; in 2023, INSERT answers with the wrong data.
The examples use a Player table with the fields playerID, firstName, surname, position and teamID.
UPDATE: change existing records
UPDATE Player SET position = "Midfield", teamID = 3 WHERE playerID = 15;
- UPDATE the table, then SET each field that changes, then WHERE to say which records.
- Two fields change here, so both go after one SET, separated by a comma. Leaving one out is the most common way to lose a mark.
- Use the primary key in WHERE when one record must change: there could be two players called Morrison.
UPDATE Player SET position = "Midfield"; is valid SQL, but it changes every player's position. The same goes for DELETE: without WHERE, every record is deleted.
INSERT: add a new record
INSERT INTO Player VALUES (16, "Eilidh", "MacLeod", "Defender", 2);
- Give a value for every field, in the same order as the fields in the table.
- Copy each value from the question, exactly. A wrong or missing value loses the mark.
- Text values go in quotes; numbers do not.
- The foreign key (here
teamID) must match a team that already exists. If it doesn't, the record is rejected: see referential integrity.
Try two exam-style questions
Choose an answer, say how sure you are, then press Check. Every wrong answer tells you why it is wrong.

The full course covers every topic like this. Every topic in National 5 Computing Science has a short note, a simulation to try and a practice quiz with feedback on every answer, plus coding lessons, a full mock exam and a progress report for parents.
More guides
- SQL with two tables: the equi-join
- Referential integrity: explaining it for the mark
- End-user and functional requirements
- All the free revision guides
This site is independent: it is not connected to the SQA or Qualifications Scotland. Points from the examiners' course reports are given in our own words.