统计logic java 课程最近一次考试学生应到人数,实到人数,缺考人数。

统计logic java 课程最近一次考试学生应到人数,实到人数,缺考人数。
提取logic java 课程最近一次考试的成绩信息并保存结果。成绩信息包括学生姓名、学号考试成绩。

logic java 最近考试日期

SELECT MAX(examdate) FROM result
WHERE subjectno = (
#logic java 科目编号
SELECT subjectNo FROM SUBJECT WHERE subjectName = ‘Logic Java’
)

logic java 课程所属年级

SELECT gradeId FROM SUBJECT WHERE subjectName = ‘Logic Java’

logic java 课程所属年级编号

SELECT subjectNo FROM subject WHERE subjectName = ‘Logic java’

应到人数

SELECT * FROM student WHERE gradeId = (
#logic java 课程所属年级
SELECT gradeId FROM SUBJECT WHERE subjectName = ‘Logic Java’
)

实到人数
SELECT *FROM result
WHERE subjectNO = (
#logic java 课程所属年级编号
SELECT subjectNo FROM subject WHERE subjectName = ‘Logic java’
)
AND examdate = (
SELECT MAX(examdate) FROM result
WHERE subjectno = (
#logic java 科目编号
SELECT subjectNo FROM SUBJECT WHERE subjectName = ‘Logic Java’)
)

统计logic java 课程最近一次考试学生应到人数,实到人数,缺考人数。

SELECT
(#应到人数
SELECT COUNT(*) FROM student WHERE gradeId = (
#logic java 课程所属年级
SELECT gradeId FROM SUBJECT WHERE subjectName = ‘Logic Java’)) AS >>’应到人数’,

(#实到人数
SELECT COUNT(*) FROM result
WHERE subjectNO = (
#logic java 课程所属年级编号
SELECT subjectNo FROM subject WHERE subjectName = ‘Logic java’)) AS ‘实到人数’,

((#应到人数
SELECT COUNT(*) FROM student WHERE gradeId = (
#logic java 课程所属年级
SELECT gradeId FROM SUBJECT WHERE subjectName = ‘Logic Java’)) -

(#实到人数
SELECT COUNT(*) FROM result
WHERE subjectNO = (
#logic java 课程所属年级编号
SELECT subjectNo FROM subject WHERE subjectName = ‘Logic java’)))AS ‘缺考人数’

提取logic java 课程最近一次考试的成绩信息并保存结果。成绩信息包括学生姓名、学号考试成绩。

提取学生的成绩信息并保存结果,包括学生姓名,学号和考试成绩。

SELECT student.studentName,student.studentNO,r.studentresult
FROM student LEFT JOIN(
#实到人数
SELECT * FROM result
WHERE subjectNO = (
#logic java 课程所属年级编号
SELECT subjectNo FROM subject WHERE subjectName = ‘Logic java’)
AND examdate = (
SELECT MAX(examdate) FROM result
WHERE subjectno = (
#logic java 科目编号
SELECT subjectNo FROM SUBJECT WHERE subjectName = ‘Logic Java’))
) AS r ON student.studentNo = r.studentNo
WHERE gradeId = (
#logic java 课程所属年级
SELECT gradeId FROM SUBJECT WHERE subjectName = ‘Logic Java’
)

DROP TABLE IF EXISTS tempResult;

CREATE TABLE tempTesult(
#提取学生的成绩信息并保存结果,包括学生姓名,学号和考试成绩。
SELECT student.studentName,student.studentNO,r.studentresult
FROM student LEFT JOIN(
#实到人数
SELECT * FROM result
WHERE subjectNO = (
#logic java 课程所属年级编号
SELECT subjectNo FROM subject WHERE subjectName = ‘Logic java’)
AND examdate = (
SELECT MAX(examdate) FROM result
WHERE subjectno = (
#logic java 科目编号
SELECT subjectNo FROM SUBJECT WHERE subjectName = ‘Logic Java’))
) AS r ON student.studentNo = r.studentNo
WHERE gradeId = (
#logic java 课程所属年级
SELECT gradeId FROM SUBJECT WHERE subjectName = ‘Logic Java’)
);

发布了15 篇原创文章 · 获赞 16 · 访问量 1万+
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 编程工作室 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览