SQL Server UPDATE: How to Modify Table Data
To update data in a table in SQL Server, you can use the UPDATE statement. The syntax is as follows:
UPDATE table_name
SET column1 = value1, column2 = value2, ...
WHERE condition;
In this case, table_name refers to the name of the table to be updated, column1, column2, etc. refer to the names of the columns to be updated, and value1, value2, etc. refer to the values to be updated. The WHERE clause is optional and used to specify the conditions for updating.
For example, to update the age of the employee named “John” in the table “employees” to 30 years old, you can use the following statement:
UPDATE employees
SET age = 30
WHERE name = 'John';