AQA · GCSE · Computer Science

    Course version: 8525 · Version from Sept 2020

    Be able to use SQL to edit and delete data in a database using the commands.

    Full specification wording

    Structured query language (SQL): Be able to use SQL to edit and delete data in a database using the commands.

    SQL is the language used to work with relational databases.

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

    • Point 8 of 10

    Study notes

    From the checked teaching notes for this specification point.

    The idea

    SQL is the language used to work with relational databases. Editing means changing values already stored in existing records, which is done with UPDATE ... SET ... WHERE. Deleting means removing whole records (rows) from a table, which is done with DELETE FROM ... WHERE. Both commands act on the rows that satisfy the WHERE condition, so the condition is the safety catch: without it, UPDATE changes every row and DELETE empties the table. For example, in a table Student with columns StudentID, Name and Year, the statement UPDATE Student SET Year = 11 WHERE StudentID = 42 changes one learner's year group, while DELETE FROM Student WHERE StudentID = 42 removes that one record. Neither command changes the table's structure; adding or removing columns is a different job.

    What earns the marks

    • UPDATE is the command that edits existing data values in a table; it does not create new records or new tables.
    • SET lists the column or columns being changed and the new value for each, for example SET Year = 11.
    • DELETE FROM removes whole records (rows) from a named table rather than blanking individual field values.
    • A WHERE clause restricts which rows are affected; omitting it means every row in the table is edited or deleted.
    • Choosing the correct command for the task: changing a stored value uses UPDATE, removing a record uses DELETE.
    • The table name follows the command (UPDATE table_name / DELETE FROM table_name) and identifies which table is affected.

    Common mistakes and how to put them right

    • Using UPDATE to remove a record.

      Put it right: UPDATE changes values in existing rows, whereas removing a record needs DELETE FROM with a WHERE condition.

    • Leaving out the WHERE clause.

      Put it right: This edits or deletes every row in the table, so always state the condition that identifies the intended record.

    • Confusing DELETE with removing a column or the whole table.

      Put it right: DELETE FROM removes rows of data, not the table's structure.

    • Writing SET before naming the table, or placing WHERE before SET.

      Put it right: The order is command, table name, SET assignments, then WHERE condition.

    Exam tips

    • Read the scenario and decide first whether a value is being changed (UPDATE) or a record is being removed (DELETE), then write the command.
    • Always include a WHERE clause that pins down the single record or group of records named in the question.
    • Check the column names and table name against any table given in the question and copy them exactly.
    • For a multiple-choice question, eliminate options that omit WHERE or that use the wrong command for the task described.

    Try the lesson

    The start of the Structured query language (SQL): Be able to use SQL to edit and delete data in a database using the commands. lesson, made from checked teaching notes for this specification point.

    Have a go first

    A table called Students has a column YearGroup. Which SQL command changes the YearGroup to 11 for the student whose StudentID is 8?

    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): Be able to use SQL to edit and delete data in a database using the commands.

    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