From: Fetch Random Rows From Database
Select random rows in MySQL
Following query will fetch 10 random rows from MySQL.
SELECT column FROM table ORDER BY RAND() LIMIT 10 |
Select random rows in Oracle
SELECT column FROM ( SELECT column FROM table ORDER BY dbms_random.value ) WHERE rownum <= 10 |
Select random rows in PostgreSQL
SELECT column FROM table ORDER BY RANDOM() LIMIT 10 |
Select random rows in Microsoft SQL Server
SELECT TOP 10 column FROM table ORDER BY NEWID() |
0 件のコメント:
コメントを投稿