2 Day Developer > Using SQL > Manipulating Data With SQL ... > Updating Data With the UPDA...
Updating Data With the UPDATE Statement |
Previous |
Next |
You can use the SQL UPDATE
statement to update data in a row of a table. The updated data must be valid for the datatype and size of each column of the table.
Example: Using the SQL UPDATE Statement to Update Data in a Table shows how to use UPDATE
to update data in the employees
table. Note the use of the multiplication operator *
to calculate a new salary. For information about arithmetic operators, See "Using Arithmetic Operators".
Using the SQL UPDATE Statement to Update Data in a Table
SELECT salary FROM employees WHERE employee_id = 11;
-- update the salary for employee 11, multiply the salary by 105%
UPDATE employees SET salary = salary * 1.05 WHERE employee_id = 11;
-- the following should show a change in salary
SELECT salary FROM employees WHERE employee_id = 11;