How to Select Random Records in MySQL?

MySQL RAND() function provides an easy way to select random rows from the table. You can get random records from the database using a single SQL query in MySQL. If you want to list the unique data on each page load, the random records feature is very useful.

Use the following SQL to select random records from a table in the MySQL database.

SELECT column FROM table
ORDER BY RAND()
LIMIT 10

Leave a reply

keyboard_double_arrow_up