数字 8,7,4,2,1,0 のうち 3つを足して10になる組み合わせをすべて求める。
with WorkView as (select 8 as Val from dual union select 7 from dual union select 4 from dual union select 2 from dual union select 1 from dual union select 0 from dual) select a.Val,b.Val,c.Val,a.Val+b.Val+c.Val as Sum from WorkView a,WorkView b,WorkView c where a.Val < b.Val and b.Val < c.Val and a.Val+b.Val+c.Val = 10;
SQLで組み合わせの問題を解くことができます。