sql不为空怎么写_你的sql语句写得如何?看看高手是怎么写的!

e9e9a32d143fad33cfab547c8d31b688.png

使用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;

caa4fed8b31f46b05606117ae3004e97.png
cc34aa37356612136751d962d2766cb0.png

02.使用SQL语句,显示“五角星”

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;

15796b6307336f6a4e8e39aff1899d75.png
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值