I have the following query to select question ids in table_question
:
$sql = "SELECT s.question_id
FROM table_question s
WHERE s.chapter_id = $chapter_id
AND s.publish_status = ".PUBLISHED_ACTIVE." AND (
s.format_type_id = ".QST_TYPE_OBJECTIVE." OR (s.format_type_id = ".QST_TYPE_SHORT_ANSWER." AND s.question_id < 200000 AND s.publish_status = ".PUBLISHED_ACTIVE."))
ORDER BY RAND() LIMIT 5";
$obj_question_ids = DB::connection('mysql_question')->select(DB::raw($sql));
In my database, I got 133010 of objective questions and 15031 subjective questions. Now, how I can make sure the ratio of my question selection will be
70% Objectives questions and 30% questions will be structure questions?