how to randomize retrieval of question from database?

后端 未结 5 1578
南旧
南旧 2021-01-20 15:06

.i have the following code:



        
5条回答
  •  無奈伤痛
    2021-01-20 15:21

    SELECT * FROM questions WHERE QuizID=1 ORDER BY RAND() LIMIT 5
    

    Will get you 5 random rows. This isn't super-efficient for a very large table, but I'm guessing that's not your case.

提交回复
热议问题