I am developing a quiz website, and I have a database which stores all of the questions. There are different types of quizzes, like math, science, history, etc. All of the questions are stored in one table.
My questions table looks like this:
questions ( qno(int) ,type(int), question, .... ,... )
qno
is the primary key, and type
is used to keep track of the quiz type.:
if type = 1 (math)
type = 2(science)
Now, I want to select some random questions for each type of test. For example, I may want to select some random 20 questions for only the math test.
Does MySQL have some way to select random rows?