Simple Query To Select N Random Rows
Join the DZone community and get the full member experience.Join For Free
A very simple, if not particularly portable or fast, quest for selecting a set of random rows from MySQL.
SELECT * from my_table ORDER BY RAND() LIMIT 25I use this a lot when testing.
Opinions expressed by DZone contributors are their own.