楼主: michelle_it168

ITPub&图灵“数据库高手擂台赛”,参赛结果已出,并附答案,敬请大家关注!

[复制链接]
论坛徽章:
5
ITPUB14周年纪念章
日期:2015-10-26 17:23:44
41#
发表于 2009-4-5 18:44 | 只看该作者
是下载下来做题目?

使用道具 举报

回复
论坛徽章:
3
2009日食纪念
日期:2009-07-22 09:30:002011新春纪念徽章
日期:2011-02-18 11:42:49ITPUB十周年纪念徽章
日期:2011-11-01 16:24:51
42#
发表于 2009-4-6 00:44 | 只看该作者
好 多翻译有问题 不过题目是太简单了

--1
select  * from MyTable
where case when nullif(f1,0) is null then 1 else 0 end +
       case when nullif(f2,0) is null then 1 else 0 end +
       case when nullif(f3,0) is null then 1 else 0 end +
       case when nullif(f4,0) is null then 1 else 0 end +
       case when nullif(f5,0) is null then 1 else 0 end +
       case when nullif(f6,0) is null then 1 else 0 end +
       case when nullif(f7,0) is null then 1 else 0 end +
       case when nullif(f8,0) is null then 1 else 0 end +
       case when nullif(f9,0) is null then 1 else 0 end +
       case when nullif(f10,0) is null then 1 else 0 end =1

只需要一次全表扫描

--4

select distinct pilot from
(select *,row=row_number()over(partition by pilot order by px)
  from
  (select x1.*,x.px from PilotSkills x1
   inner join (select *,px=row_number()over(order by plane) from Hangar)x
   on x.plane=x1.plane
  )x3)x4
where row=(select max(px) from (select *,px=row_number()over(order by plane) from Hangar)x)
/*
pilot
---------------
Smith         
Wilson         

(2 行受影响)
*/

--6
select cust_id,
sum(case when datediff(day,bill_date,getdate()) between 0 and 30 then pizza_amt else 0 end) as [0-30天],
sum(case when datediff(day,bill_date,getdate()) between 31 and 60 then pizza_amt else 0 end) as [31-60天],
sum(case when datediff(day,bill_date,getdate()) between 61 and 90 then pizza_amt else 0 end) as [61-90天],
sum(case when datediff(day,bill_date,getdate())>90 then pizza_amt else 0 end) as [90+天]
from 赊账表
group by cust_id

--7
select student_name,case when px=chose then 'Y' else 'X' end as gradnograd
from
(select student_name,count(1) as px,sum(case when x1.credits >=x2.rqd_credits then 1 else 0 end) as chose
from
(select student_name,credit_cat, sum(credits) as credits
CreditsEarned as x
group by student_name,credit_cat
)x1
left join Categories as x2
on x1.credit_cat=x2.credit_cat
group by student_name )x3

--8
select promo_name,clerk_name,account
from
(select promo_name,clerk_name,account,px=row_number()over(partition by promo_name order by account desc)
  from
  (select x1.promo_name,x.clerk_name,sum(x.sale_amt) as account
    from Sales  as x
    left join Promotions as x1
    on x.sale_date>=x1.start_date and  x.sale_date<=x1.end_date
    group by x1.promo_name,x.clerk_name
  )x2
)x3
where px=1


2个小时 5道题目

另外 2 和10是不是 题意没讲清楚?

使用道具 举报

回复
论坛徽章:
17
ITPUB新首页上线纪念徽章
日期:2007-10-20 08:38:442015年新春福章
日期:2015-03-06 11:57:31暖羊羊
日期:2015-03-04 14:50:37马上有钱
日期:2014-05-19 11:18:35马上有车
日期:2014-02-18 16:41:112014年新春福章
日期:2014-02-18 16:41:112013年新春福章
日期:2013-02-25 14:51:24奥运会纪念徽章:现代五项
日期:2012-10-16 23:29:11ITPUB 11周年纪念徽章
日期:2012-10-09 18:06:202012新春纪念徽章
日期:2012-01-04 11:50:44
43#
发表于 2009-4-6 04:29 | 只看该作者
我觉得奖品还是太少了!

使用道具 举报

回复
论坛徽章:
3
2009日食纪念
日期:2009-07-22 09:30:002011新春纪念徽章
日期:2011-02-18 11:42:49ITPUB十周年纪念徽章
日期:2011-11-01 16:24:51
44#
发表于 2009-4-6 19:17 | 只看该作者
最后2题 快了

9 和 10 有点搞

使用道具 举报

回复
论坛徽章:
1
奥运会纪念徽章:赛艇
日期:2008-10-24 13:25:17
45#
发表于 2009-4-7 10:01 | 只看该作者
Alan Flancman ran into a problem with some legacy system data that
had been moved over to an SQL database. The table looked like this:
CREATE TABLE MyTable
(keycol INTEGER NOT NULL,
f1 INTEGER NOT NULL,
f2 INTEGER NOT NULL,
f3 INTEGER NOT NULL,
f4 INTEGER NOT NULL,
f5 INTEGER NOT NULL,
f6 INTEGER NOT NULL,
f7 INTEGER NOT NULL,
f8 INTEGER NOT NULL,
f9 INTEGER NOT NULL,
f10 INTEGER NOT NULL);

使用道具 举报

回复
招聘 : Java研发
论坛徽章:
8
奥运会纪念徽章:赛艇
日期:2008-10-24 13:25:17生肖徽章2007版:牛
日期:2009-02-25 12:24:562010年世界杯参赛球队:加纳
日期:2010-03-01 09:47:242010新春纪念徽章
日期:2010-03-01 11:19:502010年世界杯参赛球队:意大利
日期:2010-04-08 15:38:112011新春纪念徽章
日期:2011-02-18 11:43:35ITPUB十周年纪念徽章
日期:2011-11-01 16:24:51优秀写手
日期:2014-10-23 06:00:14
46#
发表于 2009-4-7 12:00 | 只看该作者
把题下下来研究下

使用道具 举报

回复
论坛徽章:
13
会员2007贡献徽章
日期:2007-09-26 18:42:10迷宫蛋
日期:2011-12-27 14:19:29生肖徽章2007版:龙
日期:2009-05-11 16:32:10数据库板块每日发贴之星
日期:2009-05-09 01:01:04行业板块每日发贴之星
日期:2009-05-08 01:01:05数据库板块每日发贴之星
日期:2009-05-06 01:01:02生肖徽章2007版:虎
日期:2009-05-01 08:12:31ITPUB元老
日期:2009-04-28 16:13:16授权会员
日期:2009-04-28 16:10:34CTO参与奖
日期:2009-02-12 11:45:48
47#
发表于 2009-4-7 15:30 | 只看该作者
比写sql啊,应该是sql高手擂台赛。

使用道具 举报

回复
论坛徽章:
0
48#
发表于 2009-4-8 09:53 | 只看该作者
肯定不是中国人出题的,或直接用机器翻译的?

使用道具 举报

回复
论坛徽章:
3
2009日食纪念
日期:2009-07-22 09:30:002011新春纪念徽章
日期:2011-02-18 11:42:49ITPUB十周年纪念徽章
日期:2011-11-01 16:24:51
49#
发表于 2009-4-8 12:41 | 只看该作者
全部搞定 邮件已发 除了 第九 第10 有点难度。其他有点简单。有点对不住高手这个称号.呵呵
期待奖品和 书。:)

使用道具 举报

回复
论坛徽章:
520
奥运会纪念徽章:垒球
日期:2008-09-15 01:28:12生肖徽章2007版:鸡
日期:2008-11-17 23:40:58生肖徽章2007版:马
日期:2008-11-18 05:09:48数据库板块每日发贴之星
日期:2008-11-29 01:01:02数据库板块每日发贴之星
日期:2008-12-05 01:01:03生肖徽章2007版:虎
日期:2008-12-10 07:47:462009新春纪念徽章
日期:2009-01-04 14:52:28数据库板块每日发贴之星
日期:2009-02-08 01:01:03生肖徽章2007版:蛇
日期:2009-03-09 22:18:532009日食纪念
日期:2009-07-22 09:30:00
50#
发表于 2009-4-9 03:27 | 只看该作者
还没收场么?标准答案都被人贴出来了!(见29楼)

使用道具 举报

回复

您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

TOP技术积分榜 社区积分榜 徽章 团队 统计 知识索引树 积分竞拍 文本模式 帮助
  ITPUB首页 | ITPUB论坛 | 数据库技术 | 企业信息化 | 开发技术 | 微软技术 | 软件工程与项目管理 | IBM技术园地 | 行业纵向讨论 | IT招聘 | IT文档
  ChinaUnix | ChinaUnix博客 | ChinaUnix论坛
CopyRight 1999-2011 itpub.net All Right Reserved. 北京盛拓优讯信息技术有限公司版权所有 联系我们 未成年人举报专区 
京ICP备16024965号-8  北京市公安局海淀分局网监中心备案编号:11010802021510 广播电视节目制作经营许可证:编号(京)字第1149号
  
快速回复 返回顶部 返回列表