guoyu/log/检查学习数据.sql

33 lines
747 B
SQL

-- 1. 检查学习详情表是否有数据
SELECT * FROM learning_detail
WHERE student_id = 452
AND course_id = 1
ORDER BY create_time DESC
LIMIT 20;
-- 2. 检查学习记录表
SELECT * FROM learning_record
WHERE student_id = 452
AND course_id = 1;
-- 3. 检查学习详情表结构
DESC learning_detail;
-- 4. 统计学习详情数量
SELECT
student_id,
course_id,
courseware_id,
COUNT(*) as record_count,
MAX(create_time) as latest_time,
MAX(video_end_position) as max_position
FROM learning_detail
WHERE student_id = 452
AND course_id = 1
GROUP BY student_id, course_id, courseware_id;
-- 5. 检查最近的插入记录(所有学生)
SELECT * FROM learning_detail
ORDER BY create_time DESC
LIMIT 10;