How to get a random row from a selected 50 rows fetched using LIMIT
and OFFSET
? OFFSET
value is dynamic, it can be 0
, 50
, 100
, and so on.
The current solution is to fetch all rows and they pick one random out of them, however, would it be more efficient to do it natively using SQL?
SELECT *
FROM words
WHERE
example IS NOT NULL AND
definition IS NOT NULL AND
ORDER BY frequency DESC
LIMIT 50 OFFSET 0
Aucun commentaire:
Enregistrer un commentaire