我的数据库students
中有两个表:
GRADE_REPORT:
+----------------+-------------+------+
|StudentNo | SectionId | Grade|
+----------------+-------------+------+
| 11 | 85 | B |
| 17 | 112 | B |
| 17 | 119 | C |
| 17 | 135 | A |
| 8 | 85) | A |
| 8 | 92 | A |
+----------------+-------------+------+
STUDENT:
+----------------+-------------+------+--------+----------------+
| StudentNumber | name | Classification| DepartmentName |
+----------------+-------------+---------------+----------------+
| 17 | Bill Smith | 1 | CS |
| 8 | Bob Brown | 2 | CS |
| 11 | Nick Fiener | 4 | MATH |
+----------------+-------------+------+-----+---------+---------+
我试图找到所有做在任何课程中没有A级的学生的学号,姓名和主要部门。所以当我运行查询时,我期待以下内容:
+----------------+-------------+----------------+
| StudentNumber | name | DepartmentName |
+----------------+-------------+----------------+
| 11 | Nick Fiener | MATH |
这是我到目前为止的陈述:
SELECT students.STUDENT.StudentNumber, students.STUDENT.name,
students.STUDENT.DepartmentName
FROM students.GRADE_REPORT
INNER JOIN students.STUDENT
ON students.GRADE_REPORT.StudentNo = students.STUDENT.StudentNumber
WHERE
( (students.GRADE_REPORT.Grade = "B"
OR
students.GRADE_REPORT.Grade = "C" )
AND students.GRADE_REPORT.Grade != "A")
GROUP BY students.GRADE_REPORT.StudentNo;
编辑:
SELECT students.STUDENT.StudentNumber, students.STUDENT.name, students.STUDENT.DepartmentName
FROM students.STUDENT S
WHERE NOT EXISTS(SELECT students.GRADE_REPORT.StudentNo
FROM students.GRADE_REPORT gr
WHERE gr.StudentNo = S.StudentNumber
AND gr.Grade = "A");
答案 0 :(得分:2)
使用<style>
div{
width:50px;
height: 60px;
background: lightblue;
margin: 20px;
display:inline-block;
}
.first{
border-top-left-radius: 100% 40px;
}
.second{
border-top-right-radius: 100% 40px;
}
.third{
border-top-right-radius: 50% 40px;
border-top-left-radius: 50% 40px;
}
span{
display: inline-block;
box-sizing: border-box;
width:100%;
border:1px solid;
height: 40px;
}
</style>
</head>
<body>
<div></div>
<div class="first">
<span class="one"></span>
</div>
<div class="second">
<span class="two"></span>
</div>
<div class="third">
<span class="three"></span>
</div>
:
not exists