Message from discussion
Analytic Function: Even Distribution
Path: g2news2.google.com!news3.google.com!newsfeed.stanford.edu!sn-xt-sjc-02!sn-xt-sjc-06!sn-post-sjc-02!sn-post-sjc-01!supernews.com!corp.supernews.com!not-for-mail
From: "Ed" <e...@mail.com>
Newsgroups: comp.databases.oracle.server
Subject: Analytic Function: Even Distribution
Date: Fri, 16 Feb 2007 16:03:47 -0500
Organization: Posted via Supernews, http://www.supernews.com
Message-ID: <12tc71ljapm5i4b@corp.supernews.com>
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-Complaints-To: abuse@supernews.com
Lines: 38
Say I have a bunch of bowling players of different skill level as indicated
by his avg_score in the table below.
I need to allot them into n teams (say 8), of equivalent strength on the
TEAM level so no team ends up with mostly high-scorers and vic-versa.
(let's say players may not be evenly divided into teams because n numbers
are "sick")
Is there a way to do to this ?
Thanks
10gR2> create table players (id integer primary key, avg_score number,
team_no integer) ;
10gR2> desc players
Name Type
--------- -------
ID INTEGER
AVG_SCORE NUMBER
TEAM_NO INTEGER
10gR2> BEGIN
2 FOR i IN 1..120
3 LOOP
4 INSERT INTO players (id, avg_score)
VALUES(i,round(dbms_random.value(75,295)));
5 END LOOP;
6 END ;
7 /
10gR2> commit;