You can change the fields of existing records using UPDATE
... SET ... WHERE.
Example 1 shows a use of the UPDATE command.
Example 1
UPDATE Students
SET DateOfBirth = 04/12/2008
WHERE StudentID = 1226
Note that the = symbol can mean two different things: in a WHERE
clause, it checks if two things are equal, but in a SET clause, it changes the
value of a field.
SQL also allows us to delete records from a table using DELETE FROM
... WHERE.
Example 2 shows a use of the DELETE FROM command.
Example 2
DELETE FROM Students
WHERE StudentID = 1228
Use the
UPDATE command to subtract 1 from the StudentID of all records where it is greater than 1227.
UPDATE Students
SET StudentID = StudentID - 1
WHERE StudentID > 1227