SQL/MP Reference Manual
HP NonStop SQL/MP Reference Manual—523352-013
S-31
Examples—SELECT
N3 33.3
--- 3 row(s) selected.
The query joins table T with itself; X and Y are correlation names so that a query 
can compare one row of the table with every other row. The GROUP BY Y.C 
clause produces sets of n*v values for each distinct C value in which these are 
true:
n 
is the number of rows in the table.
v 
is the number of occurrences of a particular C value.
COUNT(DISTINCT X.I) is n for each group. The second term in the select list 
represents this equation:
(n*v)/(n*n) = (v/n)
The SELECT statement displays a distinct value of C together with its percentage 
distribution over the table.










