update 更新語句

2021-06-06 02:53:03 字數 851 閱讀 2990

update 語句用於修改表中的資料。

update 表名稱 set 列名稱 = 新值 where 列名稱 = 某值

lastname

firstname

address

city

gates

bill

xuanwumen 10

beijing

wilson

champs-elysees

我們為 lastname 是 "wilson" 的人新增 firstname:

update person set firstname = 'fred' where lastname = 'wilson'
lastname

firstname

address

city

gates

bill

xuanwumen 10

beijing

wilson

fred

champs-elysees

我們會修改位址(address),並新增城市名稱(city):

update person set address = 'zhongshan 23', city = 'nanjing'

where lastname = 'wilson'

lastname

firstname

address

city

gates

bill

xuanwumen 10

beijing

wilson

fred

zhongshan 23

nanjing

MySql批量更新語句(UPDATE)

下面建立乙個名為 bhl tes 的資料庫,並建立名為 test user 的表,字段分別為 id age name create database ifnot exists bhl test 檢視結果 檢視結果 張三 18 男 趙四 17 女 劉五 16 男 周七 19 女 檢視結果 張三 whe...

MYSQL更新語句UPDATE深入探索

以下的文章主要介紹的是mysql update 語句的實際用法,我們首先是以單錶的update語句來引出實現mysql update 語句的實際方案,以下就是文章的詳細內容描述,望你看完之後會有收穫。單錶的mysql update語句 update low priority ignore tbl n...

update 語句更新順序

create table tb 產品 varchar 2 數量 int,日期 varchar 4 單據號 varchar 4 insert into tb select a 10,9.1 001 union all select a 3,9.2 002 union all select a 4,9....