Selecting Random Records

From: shawn everett <everett(at)pgweb(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Selecting Random Records
Date: 2000-11-08 06:29:01
Message-ID: Pine.LNX.4.21.0011072224100.21321-100000@alder.pgweb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jan Wieck 2000-11-08 09:56:46 Re: how do you call one pltcl function from another?
Previous Message KuroiNeko 2000-11-08 06:20:08 Re: feature request and scripting question