SQL UPDATE: Modify Table Data

To modify the data in a table, you can use the UPDATE statement in SQL.

The basic syntax of an UPDATE statement 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 that needs to be modified, while column1, column2, etc. represent the names of the fields to be changed. Similarly, value1, value2, etc. represent the new values to be set. The condition relates to the criteria specified in the WHERE clause, determining which rows to update.

For example, to update a field value in the table to a new value, you can use the following statement:

UPDATE employees
SET salary = 50000
WHERE department = 'IT';

This will change the salary of employees in the IT department to 50000.

bannerAds