005: MySQL – Selecting a set of random rows from a table By Kushal Paudyal | April 17, 2013 - 5:45 am | SQL Code Leave a comment The following SQL select 5 random rows from database tables in MySQL. SELECT myColumns FROM mytable ORDER BY RAND() LIMIT 5 Originally posted 2007-11-18 14:41:34.