Sybase IQ 12.7 User Manual

Page of 212
 4 章    OLAP の使用
パフォーマンス&チューニング・ガイド
87
注意
これは説明用の例であり、
asiqdemo データベースから生成したものでは
ありません。
SELECT customer_id, cust_last_name, credit_limit,
WIDTH_BUCKET(credit_limit, 100, 5000, 10) "Credit
Group" 
FROM customers WHERE territory = 'MA'
ORDER BY "Credit Group";
CUSTOMER_ID
CUST_LAST_NAME
CREDIT_LIMIT
Credit Group
-----------
--------------
------------
------------
825
Dreyfuss
500
1
826
Barkin
500
1
853
Palin
400
1
827
Siegel
500
1
843
Oates
700
2
844
Julius
700
2
835
Eastwood
1200
3
840
Elliott
1400
3
842
Stern
1400
3
841
Boyer
1400
3
837
Stanton
1200
3
836
Berenger
1200
3
848
Olmos
1800
4
849
Kaurusmdki
1800
4
828
Minnelli
2300
5
829
Hunter
2300
5
852
Tanner
2300
5
851
Brown
2300
5
850
Finney
2300
5
830
Dutt
3500
7
831
Bel Geddes
3500
7
832
Spacek
3500
7
838
Nicholson
3500
7
839
Johnson
3500
7
833
Moranis
3500
7
834
Idle
3500
7
845
Fawcett
5000
11
846
Brando
5000
11
847
Streep
5000
11
範囲境界の指定が逆になっている場合は、各バケットの間隔が逆になります。
たとえば、
WIDTH_BUCKET (credit_limit500005) という関数呼び出しを考
えてみます。この例では、バケット番号
 1 は (4000 ~ 5000)、バケット番号 2
 (3000 ~ 4000) となり、以降同様に続き、バケット番号 5 は (0 ~ 1000) とな
ります。オーバフロー・バケットは番号
 0 (5000 ~ + ∞ )、アンダフロー・バ
ケットは番号
 6 (- ∞ ~ 0) となります。