Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: sampling from a table
Hi,
I have found that a 'naked' select statement ( no where clause or order by
clause) will return a 'random' set of records from a table ( Random in this case
meaning in no particular order ) since the 'order' of records stored by Oracle
is random in nature...while this is certainly not a true random sample, I find
it works for most sampling tasks...
Connor McDonald <connor_mcdonald_at_yahoo.com> wrote:
>Hagai Katz wrote:
>>
>> Shalom,
>>
>> I went fishing for some guidance on how to produce a random sample from a
>> large table, but found nothing specific. Could you please assist me as to
>> how I can draw a random sample (or any other sampling method: layered,
>> clustered, etc) from a database? I will be most greatful if you do.
>>
>> Please cc it to my eamail: katzh_at_bgumail..bgu.ac.il
>>
>> Thank you -
>>
>> Hagai Katz
>> Acting Director, The Israeli third-Sector Database,
>> ICTR - the Israeli Center for Third-sector Research
>> Ben Gurion University of the Negev,
>> Beer Sheva, Israel.
>
>If you're on 8i, there is a SAMPLE clause in SQL to do exactly that.
>
>On releases before this, using rownum combined with a random number
>generator can assist although its not too efficient. A little more
>complex but more efficient is to generate pseudo-rowid ranges
>
>HTH
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
Received on Thu Feb 03 2000 - 14:19:47 CST