有两个表A和B,均有key和value两个字段,如果B的key在A中也有,就把B的value
换为A中对应的value
这道题的SQL语句怎么写?
updateelect
bbid
setfrom
bvalueselectbawhere
avalue
from
a
where
akeybkey
where
bid
i
s
bkeyakey
f
高级sql面试题
原表courseidcourse
amescore1java702oracle903xml404jsp305servlet80为了便于阅读查询此表后的结果显式如下及格分数为60courseidcourse
amescoremark1java70pass2oracle90pass3xml40fail4jsp30fail5servlet80pass写出此查询语句
没有装ORACLE,没试过selectcourseidcourse
amescoredecode(sig
score601failpassasmarkfromcourse
完全正确
SQLdesccourse_vNameNullTypeCOURSEIDNUMBERCOURSENAMEVARCHAR210SCORENUMBER
fSQLselectfromcourse_v
COURSEIDCOURSENAMESCORE1java702oracle903xml404jsp305servlet80
SQLselectcourseidcourse
amescoredecodesig
score601failpassasmarkfromcourse_v
COURSEIDCOURSENAMESCOREMARK1java70pass2oracle90pass3xml40fail4jsp30fail5servlet80pass
原表
idproidpro
ame11M12F21N22G31B32A查询后的表
idpro1pro21MF2NG
f3BA写出查询语句
解决方案
sql求解表a列a1a2记录1a1b2x2y2z用select能选成以下结果吗?1ab2xyz使用plsql代码实现,但要求你组合后的长度不能超出oraclevarchar2长度的限制。下面是一个例子createorreplacetypestri
gs_tableistableofvarchar220createorreplacefu
ctio
mergepvi
stri
gs_tableretur
varchar2islsvarchar24000begi
forii
1pvcou
tlooplslspvie
dloopretur
lse
dcreatetabletid
umber
amevarchar210i
serti
totvalues1Joa
i
serti
totvalues1Jacki
serti
totvalues1Tomi
serti
totvalues2Rosei
serti
totvalues2Je
y
fcolum
amesformata80selectt0idmergecastmultisetselect
amefromtwheretidt0idasstri
gs_table
amesfromselectdisti
ctidfromtt0
droptypestri
gs_tabledropfu
ctio
mergedroptablet
用sql:
WellifyouhaveathoreticalmaximumwhichIwouldassumeyouwouldgive
thelegibilityoflisti
ghu
dredsofemployeesi
thewayyoudescribethe
yesButtheSQL
eedstousetheLAGfu
ctio
foreachemployeehe
ceahu
dredempsahu
dredLAGr