SQL/MX 2.x Reference Manual (H06.10+, J06.03+)

SQL/MX Functions and Expressions
HP NonStop SQL/MX Reference Manual544517-008
9-67
Examples of HashPartFunc
23 2
32 2
65 2
87 2
104 2
178 2
180 2
202 2
205 2
207 2
211 2
212 2
214 2
215 2
216 2
218 2
222 2
227 2
993 2
72 3
111 3
206 3
213 3
220 3
231 3
234 3
--- 62 row(s) selected.
This example shows the number of rows that will reside in each partition if you
create a new table that is hash-partitioned with four partitions, using the EMPNUM
column from the EMPLOYEE table. This query is based on the same data results
as the previous example, only grouped and ordered on the partition number.
>>SELECT partitionNum, count(*)
+>FROM (SELECT HashPartFunc (empnum for 4)
+> FROM employee) as Tmp(partitionNum)
+>GROUP BY partitionNum
+>ORDER BY partitionNum;
PARTITIONNUM (EXPR)
------------ --------------------
0 18
1 17
2 20
3 7
--- 4 row(s) selected.
This example shows the number of rows that will reside in each partition if you
create a new table that is hash-partitioned with four partitions (using columns a and