guoyu/检查多选题显示问题.sql
2025-12-06 20:11:36 +08:00

43 lines
1.2 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- 检查多选题显示问题
-- 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;