Updating and Deleting Data from Tables

Learn how to update and delete data from tables in a database.

Data in an MS SQL Server database is not read-only by default. We can update and delete data when needed.

The UPDATE command

It is possible to make changes to existing data in tables. To modify the data, we use the UPDATE command, with this basic syntax:

UPDATE TableSchema.TableName
SET Column1Name = [NewValue], Column2Name = [NewValue]
WHERE [Condition that decides which rows to update]

Note: The WHERE part of the command is optional. However, if it is left out, all the rows will be updated.

In this example, we’ll set the value of the PhoneNumber column to Unspecified in all rows:

Get hands-on with 1200+ tech skills courses.