Select random rows from a table in MySQL

2010
12
May

In order to select a random row from MySQL, we can order the rows by a random number and then pick the first row.

SELECT * FROM node ORDER BY rand() LIMIT 1;

The above query randomly selects a row from the table node.

Similar Posts
Related Searches




Comments

Post new comment

The content of this field is kept private and will not be shown publicly.