AQA · GCSE · Computer Science

    Course version: 8525 · Version from Sept 2020

    UPDATE table_name SET column 1 = value 1, column 2 = value 2 ... WHERE…

    Full specification wording

    Structured query language (SQL): UPDATE table_name SET column 1 = value 1, column 2 = value 2 ... WHERE condition

    This is the pattern for editing data in SQL.

    Checked against the AQA 8525 specification (opens in a new tab) on .

    • Point 9 of 10

    Study notes

    From the checked teaching notes for this specification point.

    The idea

    This is the pattern for editing data in SQL. Start with the keyword UPDATE and the name of the table whose records you want to change. Then SET gives each column a new value, written as column = value, and several columns can be changed in one statement by separating the assignments with commas. Finally WHERE states the condition that decides which rows are edited, for example WHERE StudentID = 42. So UPDATE Student SET Year = 11, Tutor = '8B' WHERE StudentID = 42 changes two fields of one record. The order matters: table name, then SET assignments, then WHERE. Text values go in single quotation marks; numbers do not. Without WHERE, every row is changed.

    What earns the marks

    • The statement begins with UPDATE followed by the table name, identifying which table's records are edited.
    • SET introduces one or more assignments in the form column = value.
    • Multiple columns can be updated in a single statement, with the assignments separated by commas.
    • The WHERE clause gives the condition that selects which rows are changed, so only matching records are edited.
    • The clauses appear in the order UPDATE table_name, SET assignments, WHERE condition.
    • Values are written appropriately: numbers as numerals and text in single quotation marks.

    Common mistakes and how to put them right

    • Putting WHERE before SET.

      Put it right: The correct order is UPDATE, table name, SET assignments, then WHERE.

    • Separating column assignments with the word AND instead of commas.

      Put it right: SET uses commas between assignments.

    • Omitting the WHERE clause, which would update every row in the table rather than the intended record.

    • Writing the table name after SET or leaving it out.

      Put it right: The table name must directly follow UPDATE.

    Exam tips

    • Build the statement in the fixed order: UPDATE, table name, SET, assignments, WHERE, condition.
    • Use commas between multiple column assignments and check each one has the form column = value.
    • Put text values in single quotation marks and leave numeric values unquoted.
    • Re-read the WHERE condition to confirm it identifies exactly the record or records the question describes.

    Try the lesson

    The start of the Structured query language (SQL): UPDATE table_name SET column 1 = value 1, column 2 = value 2 ... WHERE condition lesson, made from checked teaching notes for this specification point.

    Have a go first

    Which SQL keyword begins a statement that changes the stored values in existing records of a table?

    There is more to this lesson

    The full lesson goes on to check your understanding and help you earn the marks. Create a free account to carry on, with your progress saved.

    Carry on with the full lesson

    A week of Premium from your first lesson · Then the free plan continues · No card, no charge

    Test your understanding of Structured query language (SQL): UPDATE table_name SET column 1 = value 1, column 2 = value 2 ... WHERE condition

    Active recall beats re-reading. Take an instant quiz now to test what you’ve learned and lock it into long-term memory.

    Take topic quiz

    A week of Premium from your first lesson · Then the free plan continues · No card, no charge