How to select Random with MySQL

Select random rows from a database base with MySQL

The following query would return 1 random row from the data table:

SELECT * FROM `data` ORDER BY RAND() LIMIT 0,1;

About Ricard Torres

Senior Front-end Software Engineer from Barcelona, Haidong Gumdo Instructor (korean martial art of the sword), street photographer, travel lover, TV addict, Boston Red Sox fan, and privacy advocate.

@ricard_dev @ricard_dev

📝 Blog 🎙 Podcast

Leave a Reply

Add <code> Some Code </code> by using this tags.

*
*