日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
Oracle多表關(guān)聯(lián)中的update語句實(shí)際應(yīng)用

以下的文章主要講述的是 Oracle多表關(guān)聯(lián)中的update語句的實(shí)際應(yīng)用,為了使大家更為仔細(xì)的看明白其實(shí)際的操作步驟,我們建立了下面的簡單模型與構(gòu)造一部分的測試數(shù)據(jù):在某個業(yè)務(wù)受理子系統(tǒng)BSS中,

客戶資料表

 
 
 
  1. create table customers  
  2. (  
  3. customer_id number(8) not null,   

 

客戶標(biāo)示

 
 
 
  1. city_name varchar2(10) not null, 

所在城市

 
 
 
  1. customer_type char(2) not null, 

客戶類型

 
 
 
  1. ...  
  2. )  
  3. create unique index PK_customers on customers (customer_id)  

 

由于某些原因,客戶所在城市這個信息并不什么準(zhǔn)確,但是在

客戶服務(wù)部的CRM子系統(tǒng)中,通過主動服務(wù)獲取了部分客戶20%的所在

城市等準(zhǔn)確信息,于是你將該部分信息提取至一張臨時(shí)表中:

 
 
 
  1. create table tmp_cust_city  
  2. (  
  3. customer_id number(8) not null,  
  4. citye_name varchar2(10) not null,  
  5. customer_type char(2) not null  
  6. )  

 

1) 最簡單的形式

經(jīng)確認(rèn)customers表中所有customer_id小于1000均為'北京'

1000以內(nèi)的均是公司走向全國之前的本城市的老客戶:)

 
 
 
  1. update customers 

set city_name='北京'

 
 
 
  1. where customer_id<1000 

2) 兩表(多表)關(guān)聯(lián)Oracle update 僅在where字句中的連接

這次提取的數(shù)據(jù)都是VIP,且包括新增的,所以順便更新客戶類別

 
 
 
  1. update customers a  

使用別名

 
 
 
  1. set customer_type='01'  

01 為vip,00為普通

 
 
 
  1. where exists (select 1  
  2. from tmp_cust_city b  
  3. where b.customer_id=a.customer_id  
  4. )  

 

3) Oracle 兩表(多表)關(guān)聯(lián)update 被修改值由另一個表運(yùn)算而來

 
 
 
  1. update customers a  

使用別名

 
 
 
  1. set city_name=(select b.city_name from tmp_cust_city b where b.customer_id=a.customer_id)  
  2. where exists (select 1  
  3. from tmp_cust_city b  
  4. where b.customer_id=a.customer_id  
  5. )   

 

上述的相關(guān)內(nèi)容就是對 Oracle多表關(guān)聯(lián)的update語句的描述,希望會給你帶來一些幫助在此方面。


當(dāng)前文章:Oracle多表關(guān)聯(lián)中的update語句實(shí)際應(yīng)用
文章分享:http://m.5511xx.com/article/ccepdgj.html