Selecting Random Records - Mailing list pgsql-general

From shawn everett
Subject Selecting Random Records
Date
Msg-id Pine.LNX.4.21.0011072224100.21321-100000@alder.pgweb.com
Whole thread Raw
In response to Re: feature request and scripting question  (KuroiNeko <evpopkov@carrier.kiev.ua>)
List pgsql-general
I have a database of questions and I would like to be able to pull them
out randomly from the database using  query.

I'm thinking of something along the lines of:

SELECT random() as RND,question
FROM Problems
ORDER BY RND;

Where random() is a user defined or built in function that returns a
random number.

Is this possible?  Is there a better way to do this on the database
side.  I could do it through code in the application, I'd just prefer not
to.

Shawn


pgsql-general by date:

Previous
From: KuroiNeko
Date:
Subject: Re: feature request and scripting question
Next
From: Jan Wieck
Date:
Subject: Re: Is cycle references?