Search Postgresql Archives

Re: Random numbers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Sat, May 25, 2013 at 8:45 AM, Karel Riveron Escobar <kescobar@xxxxxxxxxxxxxxxxxx> wrote:
I want to generate random numbers in Pl/pgSQL. How can I do this?
To be more specific, I have to generate random numbers among 0 and 5.

One way:
select n from unnest(ARRAY[0,1,2,3,4,5]) n order by random() limit 1;


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux