ylbtech-SQL-W3School: SQL UPDATE statement |
1、
Update statement
Update statement to modify tables of data .
grammar:
SET UPDATE table name WHERE column name = the new value of a column name = value
Person:
LastName |
FirstName |
Address |
City |
Gates |
Bill |
Xuanwumen 10 |
Beijing |
Wilson |
|
Champs Elysees |
|
Update a column in a row
We add to firstname lastname is "Wilson" people:
UPDATE Person SET FirstName = 'Fred' WHERE LastName = 'Wilson'
result:
LastName |
FirstName |
Address |
City |
Gates |
Bill |
Xuanwumen 10 |
Beijing |
Wilson |
Fred |
Champs Elysees |
|
Update several columns in a row
We will modify the address (address), and add the city name (city):
UPDATE Person SET Address = 'Zhongshan 23', City = 'Nanjing'
WHERE LastName = 'Wilson'
result:
LastName |
FirstName |
Address |
City |
Gates |
Bill |
Xuanwumen 10 |
Beijing |
Wilson |
Fred |
Zhongshan 23 |
Nanjing |
2、
1、
2、
|
Author: ylbtech Source: http://ylbtech.cnblogs.com/ This article belongs to the author and blog Park total, welcome to reprint, but without the author's consent declared by this section must be retained, and given the original connection in the apparent position of the article page, otherwise reserves the right to pursue legal responsibilities. |