SQL update multiple rows code example

Example 1: how to change the value of a table in sql

UPDATE employees 
SET 
    address = '1300 Carter St',
    city = 'San Jose',
    postalcode = 95125,
    region = 'CA'
WHERE
    employeeID = 3;

Example 2: sql run multiple updates in one query

UPDATE table_name
SET   field_name = 
      case  field_name2 
      when 'value' then 'change_to'
      when 'value2' then 'change_to2'
end

Example 3: sql server update multiple columns at once

UPDATE Person.Person
 Set FirstName = 'Kenneth'
    ,LastName =  'Smith'
 WHERE BusinessEntityID = 1

Example 4: sql update record

UPDATE table_name
SET column1 = value1, column2 = value2...., columnN = valueN
WHERE [condition];

Example 5: update multiple columns in sql

UPDATE table-name SET column-name = value, column-name = value WHERE condition = value

Example 6: sql update record

SQL> UPDATE CUSTOMERS
SET ADDRESS = 'Pune'
WHERE ID = 6;

Tags:

Sql Example