トップページに戻る
次のSQLパズルへ
前のSQLパズルへ
10-282 dividing 5 in 3:2 ratio
SQLパズル
Val
-----
12.59
12.99
13
14.99
15
15.01
To do dividing 5 in 3:2 ratio.
that is lower 3 goes to the lower boundary and then upper 2 goes to the upper boundary.
出力結果
Val newVal
----- ------
12.59 10
12.99 10
13 15
14.99 15
15 15
15.01 15
SQL
select Val,trunc((Val+2)/5)*5 as newVal
from (select 12.59 as Val from dual union
select 12.99 from dual union
select 13 from dual union
select 14.99 from dual union
select 15 from dual union
select 15.01 from dual);
解説
dividing 5 in 3:2 ratio
と呼ばれるそうです。