출처 : http://mboy.tistory.com/49
MySQL
SELECT column FROM table ORDER BY RAND() LIMIT 1
PostgreSQL
SELECT column FROM table ORDER BY RANDOM() LIMIT 1
IBM DB2
SELECT column FROM table ORDER BY RAND() FETCH FIRST 1 ROWS ONLY
Oracle
SELECT column FROM ( SELECT column FROM table ORDER BY dbms_random.value ) WHERE rownum = 1
Microsoft SQL Server
SELECT TOP 1 column FROM table ORDER BY NEWID()
MySQL
SELECT column FROM table ORDER BY RAND() LIMIT 1
PostgreSQL
SELECT column FROM table ORDER BY RANDOM() LIMIT 1
IBM DB2
SELECT column FROM table ORDER BY RAND() FETCH FIRST 1 ROWS ONLY
Oracle
SELECT column FROM ( SELECT column FROM table ORDER BY dbms_random.value ) WHERE rownum = 1
Microsoft SQL Server
SELECT TOP 1 column FROM table ORDER BY NEWID()
'DATABASE' 카테고리의 다른 글
원하는 row 수 만큼 뽑기. (0) | 2008.10.31 |
---|---|
Oracle Table 생성 Script 알아내기. (0) | 2008.10.20 |
Oracle Table 생성 Script 알아내기. (0) | 2008.10.20 |