fahadsadah fahadsadah - 6 months ago 158
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

Comments