SQL UPDATE Query With Multiple columns & Rows
SQL UPDATE Query
If you want to Update or Modify the existing records in a table using SQL UPDATE Query. You can use the WHERE clause with the UPDATE query to update the selected rows, otherwise, you do not use WHERE clause then all the rows would be affected.
UPDATE General Syntax
1 2 |
UPDATE table-name SET column-name = value, column-name = value, ..... |
UPDATE append a WHERE clause:
1 2 3 |
UPDATE table-name SET column-name = value, column-name = value, ... WHERE condition |
Ques: Supplier John Carry (Id = 111) has moved to another city: update their, Address, city, Phone and Fax
1 2 3 |
UPDATE Employee SET Address = '17/202 N.W', City = 'New York' Phone = '(0)1-8432530' WHERE Id = 111 |
As a Result: Finally, update table from column name
Employee |
---|
Id |
CompanyName |
Position |
Address |
City |
Phone |
Explanation: finally, Record will be updated in table row where id = 111 with the respective column
Resource
SQL