楼主: qingyun

[精华] 爱因斯坦的一个问题如何用Pl/sql实现

[复制链接]
论坛徽章:
1
优秀写手
日期:2014-07-22 06:00:13
51#
发表于 2013-10-15 09:22 | 只看该作者
newkid 发表于 2009-12-30 23:04
这论坛聚集了世界上2%的人口?

真相帝

使用道具 举报

回复
论坛徽章:
407
紫蛋头
日期:2012-05-21 10:19:41迷宫蛋
日期:2012-06-06 16:02:49奥运会纪念徽章:足球
日期:2012-06-29 15:30:06奥运会纪念徽章:排球
日期:2012-07-10 21:24:24鲜花蛋
日期:2012-07-16 15:24:59奥运会纪念徽章:拳击
日期:2012-08-07 10:54:50奥运会纪念徽章:羽毛球
日期:2012-08-21 15:55:33奥运会纪念徽章:蹦床
日期:2012-08-21 21:09:51奥运会纪念徽章:篮球
日期:2012-08-24 10:29:11奥运会纪念徽章:体操
日期:2012-09-07 16:40:00
52#
发表于 2018-8-4 17:48 | 只看该作者
今天在一本书里看到,儿子非要我做,我就找出这个帖子证明我做过了

使用道具 举报

回复
论坛徽章:
548
生肖徽章2007版:猴
日期:2008-05-16 11:28:59生肖徽章2007版:马
日期:2008-10-08 17:01:01SQL大赛参与纪念
日期:2011-04-13 12:08:17授权会员
日期:2011-06-17 16:14:53ITPUB元老
日期:2011-06-21 11:47:01ITPUB官方微博粉丝徽章
日期:2011-07-01 09:45:27ITPUB十周年纪念徽章
日期:2011-09-27 16:30:472012新春纪念徽章
日期:2012-01-04 11:51:222012新春纪念徽章
日期:2020-11-30 22:13:24海蓝宝石
日期:2012-02-20 19:24:27
53#
发表于 2018-8-7 10:39 | 只看该作者
〇〇 发表于 2018-8-4 17:48
今天在一本书里看到,儿子非要我做,我就找出这个帖子证明我做过了

你儿子想检验一下你这个老爸是不是真的聪明。。

使用道具 举报

回复
论坛徽章:
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
54#
发表于 2018-8-8 04:04 | 只看该作者
〇〇 发表于 2018-8-4 17:48
今天在一本书里看到,儿子非要我做,我就找出这个帖子证明我做过了

你儿子有没有见过你itpub的头像?
不过这个头像貌似已经丢失很久了。

使用道具 举报

回复
论坛徽章:
548
生肖徽章2007版:猴
日期:2008-05-16 11:28:59生肖徽章2007版:马
日期:2008-10-08 17:01:01SQL大赛参与纪念
日期:2011-04-13 12:08:17授权会员
日期:2011-06-17 16:14:53ITPUB元老
日期:2011-06-21 11:47:01ITPUB官方微博粉丝徽章
日期:2011-07-01 09:45:27ITPUB十周年纪念徽章
日期:2011-09-27 16:30:472012新春纪念徽章
日期:2012-01-04 11:51:222012新春纪念徽章
日期:2020-11-30 22:13:24海蓝宝石
日期:2012-02-20 19:24:27
55#
发表于 2018-8-15 15:52 | 只看该作者
帖一下今天自己重做的:

SQL> with people(cno,country) as (select 1,'English'   from dual
  2                                union all
  3                               select 2,'Swedish'   from dual
  4                                union all
  5                               select 3,'Denish'    from dual
  6                                union all
  7                               select 4,'Norwegian' from dual
  8                                union all
  9                               select 5,'German'    from dual),
10          house(hno,color) as (select 1, 'Red'   from dual
11                                union all
12                               select 2,'White'  from dual
13                                union all
14                               select 3,'Yellow' from dual
15                                union all
16                               select 4,'Green'  from dual
17                                union all
18                               select 5,'Blue'   from dual),
19           drink(dno,name) as (select 1, 'Tea'   from dual
20                                union all
21                               select 2,'Coffee' from dual
22                                union all
23                               select 3, 'Beer'  from dual
24                                union all
25                               select 4, 'Milk'  from dual
26                                union all
27                               select 5,'Water'  from dual),
28          smoke(sno,brand) as (select 1, 'Pall Mall' from dual
29                                union all
30                               select 2,'Dunhill' from dual
31                                union all
32                               select 3,'Blends'  from dual
33                                union all
34                               select 4,'Blue Master' from dual
35                                union all
36                               select 5,'Prince' from dual),
37           pet(pno,animal) as (select 1,'Dog'   from dual
38                                union all
39                               select 2,'Bird'  from dual
40                                union all
41                               select 3,'Cat'   from dual
42                                union all
43                               select 4,'Horse' from dual
44                                union all
45                               select 5,'Fish'  from dual),
46      people_rank(cno_rank) as (select replace(sys_connect_by_path(cno,','),',')
47                                 from people
48                                where level=5
49                              connect by nocycle prior cno <> cno),
50       house_rank(hno_rank) as (select replace(sys_connect_by_path(hno,','),',')
51                                 from house
52                                where level=5
53                              connect by nocycle prior hno <> hno),
54       drink_rank(dno_rank) as (select replace(sys_connect_by_path(dno,','),',')
55                                 from drink
56                                where level=5
57                              connect by nocycle prior dno <> dno),
58       smoke_rank(sno_rank) as (select replace(sys_connect_by_path(sno,','),',')
59                                 from smoke
60                                where level=5
61                              connect by nocycle prior sno <> sno),
62         pet_rank(pno_rank) as (select replace(sys_connect_by_path(pno,','),',')
63                                 from pet
64                                where level=5
65                              connect by nocycle prior pno <> pno)
66  select (select country
67            from people
68           where cno=substr(cno_rank,instr(pno_rank,5),1)
69         ) as country
70    from people_rank,
71         house_rank,
72         pet_rank,
73         drink_rank,
74         smoke_rank
75   where (  substr(cno_rank,1,1)=1 and substr(hno_rank,1,1)=1
76         or substr(cno_rank,2,1)=1 and substr(hno_rank,2,1)=1
77         or substr(cno_rank,3,1)=1 and substr(hno_rank,3,1)=1
78         or substr(cno_rank,4,1)=1 and substr(hno_rank,4,1)=1
79         or substr(cno_rank,5,1)=1 and substr(hno_rank,5,1)=1) --1
80     and (  substr(cno_rank,1,1)=2 and substr(pno_rank,1,1)=1
81         or substr(cno_rank,2,1)=2 and substr(pno_rank,2,1)=1
82         or substr(cno_rank,3,1)=2 and substr(pno_rank,3,1)=1
83         or substr(cno_rank,4,1)=2 and substr(pno_rank,4,1)=1
84         or substr(cno_rank,5,1)=2 and substr(pno_rank,5,1)=1) --2
85     and (  substr(cno_rank,1,1)=3 and substr(dno_rank,1,1)=1
86         or substr(cno_rank,2,1)=3 and substr(dno_rank,2,1)=1
87         or substr(cno_rank,3,1)=3 and substr(dno_rank,3,1)=1
88         or substr(cno_rank,4,1)=3 and substr(dno_rank,4,1)=1
89         or substr(cno_rank,5,1)=3 and substr(dno_rank,5,1)=1) --3
90     --and ( translate(hno_rank,'x135','x')= 42 )
91     and (  substr(hno_rank,1,1)=4 and substr(hno_rank,2,1)=2
92         or substr(hno_rank,2,1)=4 and substr(hno_rank,3,1)=2
93         or substr(hno_rank,3,1)=4 and substr(hno_rank,4,1)=2
94         or substr(hno_rank,4,1)=4 and substr(hno_rank,5,1)=2) --4
95     and (  substr(hno_rank,1,1)=4 and substr(dno_rank,1,1)=2
96         or substr(hno_rank,2,1)=4 and substr(dno_rank,2,1)=2
97         or substr(hno_rank,3,1)=4 and substr(dno_rank,3,1)=2
98         or substr(hno_rank,4,1)=4 and substr(dno_rank,4,1)=2
99         or substr(hno_rank,5,1)=4 and substr(dno_rank,5,1)=2) --5
100     and (  substr(sno_rank,1,1)=1 and substr(pno_rank,1,1)=2
101         or substr(sno_rank,2,1)=1 and substr(pno_rank,2,1)=2
102         or substr(sno_rank,3,1)=1 and substr(pno_rank,3,1)=2
103         or substr(sno_rank,4,1)=1 and substr(pno_rank,4,1)=2
104         or substr(sno_rank,5,1)=1 and substr(pno_rank,5,1)=2) --6
105     and (  substr(hno_rank,1,1)=3 and substr(sno_rank,1,1)=2
106         or substr(hno_rank,2,1)=3 and substr(sno_rank,2,1)=2
107         or substr(hno_rank,3,1)=3 and substr(sno_rank,3,1)=2
108         or substr(hno_rank,4,1)=3 and substr(sno_rank,4,1)=2
109         or substr(hno_rank,5,1)=3 and substr(sno_rank,5,1)=2) --7
110     and ( substr(dno_rank,3,1)=4 )                            --8
111     and ( substr(cno_rank,1,1)=4 )                            --9
112     and ( substr(sno_rank,1,1)=3  and substr(pno_rank,2,1)=3
113        or substr(sno_rank,2,1)=3  and (substr(pno_rank,1,1)=3 or substr(pno_rank,3,1)=3)
114        or substr(sno_rank,3,1)=3  and (substr(pno_rank,2,1)=3 or substr(pno_rank,4,1)=3)
115        or substr(sno_rank,4,1)=3  and (substr(pno_rank,3,1)=3 or substr(pno_rank,5,1)=3)
116        or substr(sno_rank,5,1)=3  and substr(pno_rank,4,1)=3) --10
117     and ( substr(pno_rank,1,1)=4  and substr(sno_rank,2,1)=2
118        or substr(pno_rank,2,1)=4  and (substr(sno_rank,1,1)=2 or substr(sno_rank,3,1)=2)
119        or substr(pno_rank,3,1)=4  and (substr(sno_rank,2,1)=2 or substr(sno_rank,4,1)=2)
120        or substr(pno_rank,4,1)=4  and (substr(sno_rank,3,1)=2 or substr(sno_rank,5,1)=2)
121        or substr(pno_rank,5,1)=4  and substr(sno_rank,4,1)=2) --11
122     and ( substr(sno_rank,1,1)=4  and substr(dno_rank,1,1)=3
123        or substr(sno_rank,2,1)=4  and substr(dno_rank,2,1)=3
124        or substr(sno_rank,3,1)=4  and substr(dno_rank,3,1)=3
125        or substr(sno_rank,4,1)=4  and substr(dno_rank,4,1)=3
126        or substr(sno_rank,5,1)=4  and substr(dno_rank,5,1)=3) --12
127     and ( substr(cno_rank,1,1)=5  and substr(sno_rank,1,1)=5
128        or substr(cno_rank,2,1)=5  and substr(sno_rank,2,1)=5
129        or substr(cno_rank,3,1)=5  and substr(sno_rank,3,1)=5
130        or substr(cno_rank,4,1)=5  and substr(sno_rank,4,1)=5
131        or substr(cno_rank,5,1)=5  and substr(sno_rank,5,1)=5) --13
132     and ( substr(hno_rank,2,1)=5 )                            --14
133     and ( (substr(sno_rank,1,1)=3  and substr(dno_rank,2,1)=5) --15
134        or (substr(sno_rank,2,1)=3  and (substr(dno_rank,1,1)=5 or substr(dno_rank,3,1)=5))
135        or (substr(sno_rank,3,1)=3  and (substr(dno_rank,2,1)=5 or substr(dno_rank,4,1)=5))
136        or (substr(sno_rank,4,1)=3  and (substr(dno_rank,3,1)=5 or substr(dno_rank,5,1)=5))
137        or (substr(sno_rank,5,1)=3  and substr(dno_rank,4,1)=5 )
138        );
COUNTRY
---------
German

使用道具 举报

回复
论坛徽章:
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
56#
发表于 2018-8-15 22:12 | 只看该作者
我现在再炒冷饭也写不出比以前更好的,在38写的已经很好了。

使用道具 举报

回复

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

本版积分规则 发表回复

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