SQL语句简单面试题

上传人:206****923 文档编号:91042496 上传时间:2019-06-21 格式:DOC 页数:10 大小:15.11KB
返回 下载 相关 举报
SQL语句简单面试题_第1页
第1页 / 共10页
SQL语句简单面试题_第2页
第2页 / 共10页
SQL语句简单面试题_第3页
第3页 / 共10页
SQL语句简单面试题_第4页
第4页 / 共10页
SQL语句简单面试题_第5页
第5页 / 共10页
点击查看更多>>
资源描述

《SQL语句简单面试题》由会员分享,可在线阅读,更多相关《SQL语句简单面试题(10页珍藏版)》请在金锄头文库上搜索。

1、1. sqlgroup by2005-05-09 2005-05-09 2005-05-09 2005-05-09 2005-05-10 2005-05-10 2005-05-10 , sql? 2005-05-09 2 22005-05-10 1 2-create table #tmp(rq varchar(10),shengfu nchar(1)insert into #tmp values(2005-05-09,)insert into #tmp values(2005-05-09,)insert into #tmp values(2005-05-09,)insert into #tmp

2、 values(2005-05-09,)insert into #tmp values(2005-05-10,)insert into #tmp values(2005-05-10,)insert into #tmp values(2005-05-10,)1) select rq, sum(case when shengfu= then 1 else 0 end),sum(case when shengfu= then 1 else 0 end) from #tmpgroup by rq2) select n.rq,n.,m.“ from (select rq,=count(*) from #

3、tmp where shengfu=group by rq)n inner join (select rq,“=count(*) from #tmp where shengfu=group by rq)m on n.rq=m.rq3) select a.rq,a.a1 ,b.b1 from (select rq,count(rq) a1 from #tmp whereshengfu= group by rq) a,(select rq,count(rq) b1 from #tmp where shengfu= group by rq) b where a.rq=b.rq2.sqla b c,s

4、qlababbcbc-create table #tmp(a int,b int,c int)insert into #tmp values(10,20,30)-insert into #tmp values(10,30,20)-insert into #tmp values(40,10,20)select * from #tmpselect (case when a>b then a else b end),(case when b>c then b else c end ) from #tmp3.sqltb_send(sendtime)?(sendtimedatetime)-s

5、elect * from #tmp where datediff(dd,rq,getdate()=0select * from #tmp where rq=rtrim(convert(varchar,getdate(),23)4.33708058sql806060 -create table #tmp( int, int , int)insert into #tmp values(70,80,58)-insert into #tmp values(100,50,60)select * from #tmpselect (case when >=80 then when >=60 th

6、en else end ) ,(case when >=80 then when >=60 then else end ) ,(case when >=80 then when >=60 then else end ) from #tmp5.sqlserver2000sqlididvalues,int?-:create table #xx(id int, idvalues int):create table #xx(id int, idvalues int):session,.sql server,session,.6.sqlserver2000-(*.dbf),sql

7、 server.sql server 2000 .mdf .ndf .ldf7.sqltable1,table2table3table1mon dep yj-01100210035028049038table2depdname-01020304table3 resultdep -0110 nullnull02108 null03null 5 804nullnull9-create table #a(mon varchar(10),dep varchar(10) ,yj int)insert into #a values(,01,10)insert into #a values(,02,10)i

8、nsert into #a values(,03,5)insert into #a values(,02,8)insert into #a values(,04,9)insert into #a values(,03,8)select * from #acreate table #b(dep varchar(10),dname varchar(20)insert into #b values(01,)insert into #b values(02,)insert into #b values(03,)insert into #b values(04,)select * from #b-1) sele

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 中学教育 > 其它中学文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号