AQA · GCSE · Computer Science · Higher
SQL UPDATE query construction
The film with the title Toy Story 3 has been entered incorrectly into the database and should have the title Toy Story 4.
| FilmID | Title | Year |
|---|---|---|
| 100 | Forrest Gump | 1994 |
| 101 | Toy Story 3 | 2019 |
| 102 | Back to the Future | 1985 |
Write the SQL to make this change.
Write your answer first. You can study the marking guidance whenever you need it.
Study the marking See what earns credit and compare it with a full-mark answer.
Marking points
- 1 Uses UPDATE Film.
- 2 Sets Title to 'Toy Story 4'.
- 3 Selects the exact record with either WHERE FilmID = 101 or WHERE Title = 'Toy Story 3'.
Full-mark answer
UPDATE Film SET Title = 'Toy Story 4' WHERE Title = 'Toy Story 3'
Why this answer loses marks
I supplied the new value but omitted the row filter.
Without a filter condition, the update is not restricted to the one incorrect record.