Select random records in a MySQL database

mysql-logo.gif
Say you want to select some random records in a MySQL database. Here is a fast way to do it:

SELECT *
FROM tableName
WHERE conditions
ORDER BY Rand()

Using the Rand() function will randomly select the rows. You can limit the number of rows returned by using the LIMIT command