--This
is how you can generate values to show some central value concepts.
--You
can compare this SQL PL script with the T-SQL script on the miscellaneous page.
--By
C. Eric Cashon
CREATE
TABLE SampleValues(
List real);
INSERT
INTO SampleValues
-- Generate 50 records.
WITH
Generate(List) AS (VALUES(1) UNION ALL SELECT List+1 FROM Generate WHERE List
< 50 )
SELECT
List FROM Generate;
--Check
your table.
SELECT
* FROM SampleValues;
--Get
all combinations of two
CREATE
VIEW Distribution (List1, List2, HalfTotal)
AS
SELECT T1.List, T2.List, ((T1.List +
T2.List)/2) AS HalfTotal
FROM SampleValues T1, SampleValues T2
WHERE T1.List < T2.List;
--Take
a look at the numbers.
SELECT
* FROM Distribution Order BY List1;
--Check
your row count for pairs of two.
--C
= 50!/(2!(50 - 2)!)
-- = 1225
SELECT
COUNT(*) FROM Distribution;
--Look
at the distribution.
SELECT
REPEAT('*', COUNT(HalfTotal))
FROM Distribution
GROUP BY HalfTotal;
--Clean
Up
DROP TABLE SampleValues;
DROP VIEW Distribution;