fahadsadah fahadsadah - 9 months ago 224
SQL Question

Select random row(s) in SQLite

In MySQL, you can select X random rows with the following statement:

SELECT * FROM table ORDER BY RAND() LIMIT X


This does not, however, work in SQLite. Is there an equivalent?

Answer

SELECT * FROM table ORDER BY RANDOM() LIMIT X