Decode360's Blog

          業精于勤而荒于嬉 QQ:150355677 MSN:decode360@hotmail.com

            BlogJava :: 首頁 :: 新隨筆 :: 聯系 ::  :: 管理 ::
            302 隨筆 :: 26 文章 :: 82 評論 :: 0 Trackbacks
          <2008年11月>
          2627282930311
          2345678
          9101112131415
          16171819202122
          23242526272829
          30123456

          公告

          常用鏈接

          隨筆分類(299)

          隨筆檔案(299)

          文章分類(26)

          新聞分類(24)

          收藏夾(5)

          Blog列表

          IT網站

          My Link

          最新隨筆

          最新評論

          http://www.itpub.net/viewthread.php?tid=981654&extra=&page=1
          ?
          大牛寫的這兩段SQL實在是太銷魂了,實在是忍不住要轉載過來,留著以后慢慢看,太牛了……
          ?
          ?
          with a as (select distinct round(a.x + b.x) x,round(a.y + b.y) y from
          (select (sum(x) over(order by n)) x,
          ? ?? ?? ?? ?? ?? ?? ?? ?? ? round(sum(y) over(order by n)) y
          ? ?? ?? ?? ???from (select n, cos(n/30 * 3.1415926)*2??x,
          ? ?? ?? ?? ?? ?? ?? ?? ?? ?sin(n/30 * 3.1415926) y
          ? ?? ?? ?? ?? ?? ?? ?? ?? ?from (select rownum - 1 n from all_objects where rownum <= 30 +30))) a,
          ? ?? ?? ?? ?(select n, (sum(x) over(order by n)) x,
          ? ?? ?? ?? ?? ?? ?? ?? ?? ? round(sum(y) over(order by n)) y
          ? ?? ?? ?? ???from (select n,
          ? ?? ?? ?? ?? ?? ?? ?? ?? ?cos( m /3 * 3.1415926) * 2 * 15 x,
          ? ?? ?? ?? ?? ?? ?? ?? ?? ?sin( m /3 * 3.1415926)* 15 y
          ? ?? ?? ?? ?? ?? ?? ? from (select case when rownum <= 2 then 3
          ? ?? ?? ?? ?? ?? ?? ? when rownum = 3 then -2 else -6 end m, rownum - 1 n
          ? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?from all_objects where rownum <= 5))) b
          ? ?? ?? ? )
          select replace(sys_connect_by_path(point, '/'), '/', null) star
          ??from (select b.y, b.x, decode(a.x, null, ' ', '*') point
          ? ?? ?? ? from a,
          ? ?? ?? ?? ?? ?(select *
          ? ?? ?? ?? ?? ?? ?from (select rownum - 1 + (select min(x) from a) x
          ? ?? ?? ?? ?? ?? ?? ?? ???from all_objects
          ? ?? ?? ?? ?? ?? ?? ?? ? where rownum <= (select max(x) - min(x) + 1 from a)),
          ? ?? ?? ?? ?? ?? ?? ???(select rownum - 1 + (select min(y) from a) y
          ? ?? ?? ?? ?? ?? ?? ?? ???from all_objects
          ? ?? ?? ?? ?? ?? ?? ?? ? where rownum <= (select max(y) - min(y) + 1 from a))) b
          ? ?? ?? ?where a.x(+) = b.x
          ? ?? ?? ???and a.y(+) = b.y)
          where x = (select max(x) from a)
          start with x = (select min(x) from a)
          connect by y = prior y
          ? ?? ? and x = prior x + 1;
          ?
          ?

          ????????????? * * * * * *?????????????????? * * * * * *?????????????????? * * * * * *?????????????
          ????????? * *???????????? * *?????????? * *???????????? * *?????????? * *???????????? * *?????????
          ?????? * *?????????????????? * *???? * *?????????????????? * *???? * *?????????????????? * *??????
          ???? *?????????????????????????? * *?????????????????????????? * *?????????????????????????? *????
          ?? **??????????????????????????? ***?????????????????????????? ***??????????????????????????? **??
          ? *???????????????????????????? *?? *???????????????????????? *?? *???????????????????????????? *?
          ?*???????????????????????????? *???? *?????????????????????? *???? *???????????????????????????? *
          ?*???????????????????????????? *???? *?????????????????????? *???? *???????????????????????????? *
          *???????????????????????????? *?????? *???????????????????? *?????? *???????????????????????????? *
          *???????????????????????????? *?????? *???????????????????? *?????? *???????????????????????????? *
          *???????????????????????????? *?????? *???????????????????? *?????? *???????????????????????????? *
          *???????????????????????????? *?????? *???????????????????? *?????? *???????????????????????????? *
          ?*???????????????????????????? *???? *?????????????????????? *???? *???????????????????????????? *
          ?*?????????????????????????? * * * * * *?????????????????? * * * * * *?????????????????????????? *
          ? *????????????????????? * *??? *?? *??? * *?????????? * *??? *?? *??? * *????????????????????? *?
          ?? *????????????????? * *??????? * *??????? * *???? * *??????? * *??????? * *????????????????? *??
          ??? **????????????? *??????????? ***??????????? * *??????????? ***??????????? *????????????? **???
          ?????? *????????? **?????????? *???? *????????? ***????????? *???? *?????????? **????????? *??????
          ???????? ** *??? *??????? * **???????? ** *??? *?? *??? * **???????? ** *??????? *??? * **????????
          ????????????? * * * * * *?????????????????? * * * * * *?????????????????? * * * * * *?????????????
          ??????????????? *???????????????????????????? *???? *???????????????????????????? *???????????????
          ?????????????? *???????????????????????????? *?????? *???????????????????????????? *??????????????
          ?????????????? *???????????????????????????? *?????? *???????????????????????????? *??????????????
          ?????????????? *???????????????????????????? *?????? *???????????????????????????? *??????????????
          ?????????????? *???????????????????????????? *?????? *???????????????????????????? *??????????????
          ??????????????? *???????????????????????????? *???? *???????????????????????????? *???????????????
          ??????????????? *???????????????????????????? *???? *???????????????????????????? *???????????????
          ???????????????? *???????????????????????????? *?? *???????????????????????????? *????????????????
          ????????????????? *???????????????????????????? * *???????????????????????????? *?????????????????
          ?????????????????? **?????????????????????????? ***?????????????????????????? **??????????????????
          ????????????????????? *?????????????????????? *???? *?????????????????????? *?????????????????????
          ??????????????????????? ** *???????????? * **???????? ** *???????????? * **???????????????????????
          ???????????????????????????? * * * * * *?????????????????? * * * * * *????????????????????????????
          ?
          with a as (
          ??????????? select distinct round(sum(x) over(order by n)) x,
          ??????????????????????????? round(sum(y) over(order by n)) y
          ????????????? from (select n,
          ?????????????????????????? cos(trunc(n / 20) * (1-1/5) * 3.1415926) * 2 x,
          ?????????????????????????? sin(trunc(n / 20) * (1-1/5) * 3.1415926) y
          ????????????????????? from (select rownum - 1 n from all_objects where rownum <= 20 * 5))
          ????????? )
          select replace(sys_connect_by_path(point, '/'), '/', null) star
          ? from (select b.y, b.x, decode(a.x, null, ' ', '*') point
          ????????? from a,
          ?????????????? (select *
          ????????????????? from (select rownum - 1 + (select min(x) from a) x
          ????????????????????????? from all_objects
          ???????????????????????? where rownum <= (select max(x) - min(x) + 1 from a)),
          ?????????????????????? (select rownum - 1 + (select min(y) from a) y
          ????????????????????????? from all_objects
          ???????????????????????? where rownum <= (select max(y) - min(y) + 1 from a))) b
          ???????? where a.x(+) = b.x
          ?????????? and a.y(+) = b.y)
          where x = (select max(x) from a)
          start with x = (select min(x) from a)
          connect by y = prior y
          ?????? and x = prior x + 1;



          ??????????????????? *???????????????????
          ?????????????????? * *??????????????????
          ?????????????????? * *??????????????????
          ????????????????? *?? *?????????????????
          ???????????????? **?? **????????????????
          ??????????????? *?????? *???????????????
          ??????????????? *?????? *???????????????
          * * * * * * * *** * * * *** * * * * * * *
          ? **????????? *?????????? *????????? **?
          ???? **?????? *?????????? *?????? **????
          ??????? *??? *???????????? *??? *???????
          ????????? ** *???????????? * **?????????
          ??????????? ** *???????? * **???????????
          ?????????? *??? * *?? * *??? *??????????
          ?????????? *?????? * *?????? *??????????
          ????????? *????? * * * *????? *?????????
          ???????? *??? * *?????? * *??? *????????
          ???????? *? *?????????????? *? *????????
          ??????? ** *???????????????? * **???????
          ??????? *?????????????????????? *???????
          ?
          ?
          ?
          ?
          ?



          -The End-

          posted on 2008-11-01 19:47 decode360-3 閱讀(278) 評論(0)  編輯  收藏 所屬分類: SQL Dev
          主站蜘蛛池模板: 柳江县| 东城区| 江门市| 田阳县| 马尔康县| 封丘县| 卓尼县| 通海县| 疏附县| 峡江县| 郓城县| 县级市| 山西省| 扬中市| 东台市| 芜湖县| 扎鲁特旗| 南靖县| 邳州市| 北京市| 陆丰市| 颍上县| 虎林市| 汉阴县| 灵山县| 翼城县| 宁乡县| 微博| 汤阴县| 富蕴县| 定远县| 南溪县| 阳原县| 胶南市| 新丰县| 修文县| 迭部县| 蓝田县| 阳高县| 彰化市| 富川|