DATABASE별 결과 값 RANDOM 으로 나오게 하기

2013. 10. 8. 15:04Database

ORACLE

SELECT * FROM TABLE_NAME SAMPLE (3)

SELECT * FROM (
SELECT * FROM TABLE_NAME ORDER BY DBMS_RANDOM.VALUE
)
WHERE ROWNUM < 3 

MSSQL

SELECT TOP 3 * FROM TABLE_NAME ORDER BY NEWID()

MYSQL

SELECT * FROM TABLE_NAME ORDER BY RAND() LIMIT 0,3