i am making a n application based on quiz therefore i need to select data randomly from database i m using sqlite please help
+1
A:
You should check RANDOM() function, ex:
SELECT * FROM table ORDER BY RANDOM() LIMIT 1;
Maciej Kucharz
2010-08-05 09:44:14
thanks..........
Online
2010-08-07 12:49:49
A:
To minimise hits on the database, I would suggest reading out all of your questions into a data structure in memory (assuming there's not so many that it would consume all memory).
You could then shuffle the array using a decent shuffle algorithm and pop questions from the array to use.
Jasarien
2010-08-05 11:10:20