1一道SQL语句面试题,关于groupby表内容:20050509胜20050509胜20050509负20050509负20050510胜20050510负20050510负如果要生成下列结果该如何写sql语句胜负20050509222005051012createtabletmprqvarchar10she
gfu
char1i
serti
totmpvalues20050509胜i
serti
totmpvalues20050509胜i
serti
totmpvalues20050509负i
serti
totmpvalues20050509负i
serti
totmpvalues20050510胜i
serti
totmpvalues20050510负i
serti
totmpvalues20050510负1selectrqsumcasewhe
she
gfu胜the
1else0e
d胜sumcasewhe
she
gfu负the
1else0e
d负fromtmpgroupbyrq2selectNrqNMfromselectrqcou
tfromtmpwhereshe
gfu胜groupbyrqNi
erjoi
selectrqcou
tfromtmpwhereshe
gfu负groupbyrqMo
NrqMrq3selectarqaa1胜bb1负fromselectrqcou
trqa1fromtmpwhereshe
gfu胜groupbyrqa
wxyTASF51PjDIRzckvWofsuprta
dhgeCbliqm鉴血史历刻深下留后也失损和难灾前空来带民人国中给略场这争战华侵的久已谋蓄了动发本日
fselectrqcou
trqb1fromtmpwhereshe
gfu负groupbyrqbarqbrq2请教一个面试中遇到的SQL语句的查询问题
where
表中有ABC三列用SQL语句实现:当A列大于B列时选择A列否则选择B列,当B列大于C列时选择B列否则选择C列。createtabletmpAi
tBi
tCi
ti
serti
totmpvalues102030i
serti
totmpvalues103020i
serti
totmpvalues401020selectfromtmpselectcasewhe
abthe
aelsebe
dcasewhe
bcthe
belsece
dfromtmp
3面试题:一个日期判断的sql语句?请取出tb_se
d表中日期Se
dTime字段为当天的所有记录Se
dTime字段为datetime型,包含日期与时间selectfromtmpwheredatediffddrqgetdate0selectfromtmpwhererqrtrimco
vertvarchargetdate234有一张表,里面有3个字段:语文,数学,英语。其中有3条记录分别表示语文70分,数学80分,英语58分,请用一条sql语句查询出这三条记录并按以下条件显示出来(并写出您的思路):大于或等于80表示优秀,大于或等于60表示及格,小于60分表示不及格。显示格式:语文学及格秀不及格英语优数
wxyTASF51PjDIRzckvWofsuprta
dhgeCbliqm鉴血史历刻深下留后也失损和难灾前空来带民人国中给略场这争战华侵的久已谋蓄了动发本日
fcreatetabletmp语文i
t数学i
t英语i
ti
serti
totr