PostgreSQL Database - sql lottery

select * from users order by random (); - will conduct random order, each run will return different results

select * from users order by random () limit 1; - random ordering will be run every time a record will be returned to simulate lottery

Guess you like

Origin www.cnblogs.com/dongyaotou/p/12374987.html