SQL中RANDOM函数返回随机行

  sre

MySQL

SELECT column FROM table
ORDER BY RAND ( )
LIMIT 1

SQL Server

SELECT TOP 1 column FROM table
ORDER BY NEW ID()

Oracle

SELECT column FROM
(SELECT column FROM table
ORDER BY dbms_random.value)
WHERE rownum =1

PostgreSQL

SELECT column FROM table
ORDER BY RAND()
LIMIT 1

LEAVE A COMMENT

Captcha Code