Once there's data in the table, we might find that there is a need to
modify the data. To do so, here in SQL Tutorial we can use the UPDATE command to
do so. The syntax for SQL Update Statement is as under
For example, say we currently have a table as below and we want to update it.:
Table
Employees_Salary
| FirstName |
Month |
Salary |
| Austin |
February |
1100$ |
| Creston |
February |
1100$ |
| Kate |
February |
1100$ |
| Angela |
February |
1000$ |
| Bobbi |
February |
1200$ |
and now suppose we need to change the salary for Angela from 1000$ to 1200$ ,
for that particular entry needs to be updated. To do
so, we use the following SQL Update Statement
The resulting table would look like
Result of SQL Update Statement Example:
| FirstName |
Month |
Salary |
| Austin |
February |
1100$ |
| Creston |
February |
1100$ |
| Kate |
February |
1100$ |
| Angela |
February |
1200$ |
| Bobbi |
February |
1200$ |
In this case, there is only one row that satisfies the
condition in the SQL WHERE clause. If there are multiple rows
that satisfy the condition, all of them will be modified.
It is also possible to UPDATE multiple columns at the same
time. The syntax for update multiple columns in this case would look like the
following, and this SQL Tutorial section will cover all the needs of SQL update
statement clause.