# training_data

type: ddl
content:
CREATE TABLE "public"."t_crawler_lesson" (
  "lesson_id" varchar(255) COLLATE "pg_catalog"."default",
  "lesson_name" varchar(255) COLLATE "pg_catalog"."default",
  "node_id" varchar(255) COLLATE "pg_catalog"."default",
  "teacher_id" varchar(255) COLLATE "pg_catalog"."default",
  "teacher_name" varchar(255) COLLATE "pg_catalog"."default",
  "teacher_school_id" varchar(255) COLLATE "pg_catalog"."default",
  "teacher_school_name" varchar(255) COLLATE "pg_catalog"."default",
  "id" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "book_id" varchar(255) COLLATE "pg_catalog"."default",
  "scheme_id" varchar(255) COLLATE "pg_catalog"."default",
  "preview_count" int4 DEFAULT 0,
  "learning_person_count" int4 DEFAULT 0,
  "learning_person_times" int4 DEFAULT 0,
  "grade_code" varchar(255) COLLATE "pg_catalog"."default",
  "publish_time" date,
  "node_type" int2 DEFAULT 1,
  "gather_regionc" varchar(255) COLLATE "pg_catalog"."default",
  "school_running_type" varchar(255) COLLATE "pg_catalog"."default",
  "stage_name" varchar(255) COLLATE "pg_catalog"."default",
  "subject_name" varchar(255) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."t_crawler_lesson"."lesson_id" IS '课程ID';
COMMENT ON COLUMN "public"."t_crawler_lesson"."lesson_name" IS '课程名称';
COMMENT ON COLUMN "public"."t_crawler_lesson"."node_id" IS '隶属哪个章节目录节点，关联t_crawler_structure中的node_id';
COMMENT ON COLUMN "public"."t_crawler_lesson"."teacher_id" IS '教师ID';
COMMENT ON COLUMN "public"."t_crawler_lesson"."teacher_name" IS '教师姓名';
COMMENT ON COLUMN "public"."t_crawler_lesson"."teacher_school_id" IS '教师学校ID,这个无用，处理关联学校时，使用t_crawler_lesson_school表';
COMMENT ON COLUMN "public"."t_crawler_lesson"."teacher_school_name" IS '教师学校名称';
COMMENT ON COLUMN "public"."t_crawler_lesson"."id" IS '主键';
COMMENT ON COLUMN "public"."t_crawler_lesson"."book_id" IS '册ID';
COMMENT ON COLUMN "public"."t_crawler_lesson"."scheme_id" IS '版本ID';
COMMENT ON COLUMN "public"."t_crawler_lesson"."preview_count" IS '预览次数';
COMMENT ON COLUMN "public"."t_crawler_lesson"."learning_person_count" IS '学习人数';
COMMENT ON COLUMN "public"."t_crawler_lesson"."learning_person_times" IS '学习人次';
COMMENT ON COLUMN "public"."t_crawler_lesson"."grade_code" IS '学段代码';
COMMENT ON COLUMN "public"."t_crawler_lesson"."publish_time" IS '发布时间';
COMMENT ON COLUMN "public"."t_crawler_lesson"."node_type" IS '节点类型 1：章节目录 2：知识点';
COMMENT ON COLUMN "public"."t_crawler_lesson"."gather_regionc" IS '行政区域名称';
COMMENT ON COLUMN "public"."t_crawler_lesson"."school_running_type" IS '学校类型';
COMMENT ON COLUMN "public"."t_crawler_lesson"."stage_name" IS '学段名称';
COMMENT ON COLUMN "public"."t_crawler_lesson"."subject_name" IS '学科名称';
COMMENT ON TABLE "public"."t_crawler_lesson" IS '课程，resource资源表';


type: qa
question:
SELECT lesson_id, lesson_name, node_id, teacher_id, teacher_name, teacher_school_id, teacher_school_name, id, book_id, scheme_id, preview_count, learning_person_count, learning_person_times, grade_code, publish_time, node_type, gather_regionc, school_running_type, stage_name, subject_name FROM public.t_crawler_lesson;

sql:
查询:
1、发布时间是2024年度
2、每个学段，每个科目，上传课程数量，按由多到少排序
3、字段名: 学段,科目,排名,课程数量
SELECT stage_name AS 学段, subject_name AS 科目, ROW_NUMBER() OVER (PARTITION BY stage_name ORDER BY COUNT(*) DESC) AS 排名, COUNT(*) AS 课程数量 FROM t_crawler_lesson WHERE publish_time >= '2024-01-01' AND publish_time < '2025-01-01' AND gather_regionc IS NOT NULL AND gather_regionc <> '' GROUP BY stage_name, subject_name ORDER BY stage_name, 课程数量 DESC


type: qa
question:
SELECT lesson_id, lesson_name, node_id, teacher_id, teacher_name, teacher_school_id, teacher_school_name, id, book_id, scheme_id, preview_count, learning_person_count, learning_person_times, grade_code, publish_time, node_type, gather_regionc, school_running_type, stage_name, subject_name FROM public.t_crawler_lesson;

sql:
查询:
1、发布时间是2024年度
2、每个行政区每个学校都上传了多少课程数量
3、格式: 行政区划名,学段,排名,学校名称,课程数量
SELECT gather_regionc AS 行政区划名, stage_name AS 学段, ROW_NUMBER() OVER (PARTITION BY gather_regionc ORDER BY COUNT(*) DESC) AS 排名, teacher_school_name AS 学校名称, COUNT(*) AS 课程数量 FROM t_crawler_lesson WHERE publish_time >= '2024-01-01' AND publish_time < '2025-01-01' AND gather_regionc IS NOT NULL AND gather_regionc != '' GROUP BY gather_regionc, stage_name, teacher_school_name ORDER BY gather_regionc, COUNT(*) DESC


type: qa
question:
SELECT lesson_id, lesson_name, node_id, teacher_id, teacher_name, teacher_school_id, teacher_school_name, id, book_id, scheme_id, preview_count, learning_person_count, learning_person_times, grade_code, publish_time, node_type, gather_regionc, school_running_type, stage_name, subject_name FROM public.t_crawler_lesson;

sql:
查询:
1、发布时间是2024年度
2、二道区每个学校都上传了多少课程数量
3、格式: 行政区划名,学段,排名,学校名称,发布年份,课程数量
SELECT gather_regionc AS 行政区划名, stage_name AS 学段, ROW_NUMBER() OVER (PARTITION BY gather_regionc ORDER BY COUNT(*) DESC) AS 排名, teacher_school_name AS 学校名称, EXTRACT(YEAR FROM publish_time) AS 发布年份, COUNT(*) AS 课程数量 FROM t_crawler_lesson WHERE publish_time >= '2024-01-01' AND publish_time < '2025-01-01' AND gather_regionc = '二道区' AND gather_regionc IS NOT NULL AND gather_regionc != '' GROUP BY gather_regionc, stage_name, teacher_school_name, EXTRACT(YEAR FROM publish_time) ORDER BY gather_regionc, 课程数量 DESC


type: qa
question:
SELECT lesson_id, lesson_name, node_id, teacher_id, teacher_name, teacher_school_name, id, book_id, scheme_id, preview_count, learning_person_count, learning_person_times, grade_code, publish_time, node_type, gather_regionc, school_running_type, stage_name, subject_name FROM public.t_crawler_lesson;

sql:
查询:
1、发布时间是2024年度
2、每个行政区每个学校都上传了多少课程数量
3、格式: 行政区划名,学段,排名,学校名称,课程数量
SELECT gather_regionc AS 行政区划名, stage_name AS 学段, ROW_NUMBER() OVER (PARTITION BY gather_regionc ORDER BY COUNT(*) DESC) AS 排名, teacher_school_name AS 学校名称, COUNT(*) AS 课程数量 FROM t_crawler_lesson WHERE publish_time >= '2024-01-01' AND publish_time < '2025-01-01' AND gather_regionc IS NOT NULL AND gather_regionc != '' GROUP BY gather_regionc, stage_name, teacher_school_name ORDER BY gather_regionc, COUNT(*) DESC


