guoyu/Test/sql/正确查询文件路径.sql

22 lines
557 B
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.

-- 正确的SQL查询根据实际表结构
-- 1. 查询课件表中的文件路径(最重要)
SELECT id, title, type, file_path, file_size, file_name, create_time
FROM courseware
ORDER BY create_time DESC
LIMIT 10;
-- 2. 查询课程表(看看有没有图片字段)
DESC course;
-- 3. 查看courseware表的完整结构
DESC courseware;
-- 4. 统计不同路径前缀的文件数量
SELECT
SUBSTRING_INDEX(file_path, '/', 3) AS path_prefix,
COUNT(*) AS file_count
FROM courseware
WHERE file_path IS NOT NULL
GROUP BY path_prefix;