How to request a random row in SQL?

前端 未结 29 2992
孤城傲影
孤城傲影 2020-11-21 06:45

How can I request a random row (or as close to truly random as is possible) in pure SQL?

29条回答
  •  面向向阳花
    2020-11-21 07:31

    Random function from the sql could help. Also if you would like to limit to just one row, just add that in the end.

    SELECT column FROM table
    ORDER BY RAND()
    LIMIT 1
    

提交回复
热议问题