Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Simple query to select N random rows (See related posts)

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 25

I use this a lot when testing.

You need to create an account or log in to post comments to this site.


Click here to browse all 4861 code snippets

Related Posts