-- 检查多选题显示问题

-- 1. 查看考试中的题目类型
SELECT 
    eq.id AS 题目ID,
    eq.exam_id AS 考试ID,
    e.exam_name AS 考试名称,
    eq.question_type AS 题型,
    LEFT(eq.question_content, 50) AS 题目内容,
    CASE 
        WHEN eq.question_type = 'single' THEN '单选题'
        WHEN eq.question_type = 'multiple' THEN '多选题'
        WHEN eq.question_type = 'judge' THEN '判断题'
        WHEN eq.question_type = 'fill' THEN '填空题'
        ELSE eq.question_type
    END AS 题型名称
FROM study_exam_question eq
LEFT JOIN study_exam e ON eq.exam_id = e.id
WHERE e.exam_name LIKE '%Test%'  -- 根据截图中的考试名称
ORDER BY eq.exam_id, eq.question_order;

-- 2. 检查是否有多选题
SELECT 
    eq.exam_id AS 考试ID,
    e.exam_name AS 考试名称,
    eq.question_type AS 题型,
    COUNT(*) AS 数量
FROM study_exam_question eq
LEFT JOIN study_exam e ON eq.exam_id = e.id
GROUP BY eq.exam_id, e.exam_name, eq.question_type
ORDER BY eq.exam_id;

-- 3. 查看题目详细内容（查看前5道题）
SELECT 
    id,
    question_type,
    question_content,
    options
FROM study_exam_question
WHERE exam_id IN (SELECT id FROM study_exam WHERE exam_name LIKE '%Test%')
ORDER BY question_order
LIMIT 5;
