【发布时间】:2019-12-15 10:23:48
【问题描述】:
我正在尝试查找存在对称对的学生的姓名。有3个表:
**student**
student_id (Primary Key) | smallint
student_name | varchar(30)
**mathematics_marks**
student_id (Primary Key) | smallint
score | float (5,2)
**science_marks**
student_id (Primary Key) | smallint
score | float (5,2)
with Functions as (
select s.student_name as name, mm.score as math_score, sm.score as science_score
from student s
join mathematics_marks mm
on mm.student_id = s.student_id
join science_marks sm
on sm.student_id = s.student_id)
select t1.name
from Functions t1
join Functions t2
on t1.math_score = t2.science_score
and t1.science_score = t2.math_score
where t1.math_score < t1.science_score
编辑您的评论:如果该学生在科学中获得的分数等于其他学生在数学中获得的分数并且在数学中获得的分数相同,则该学生被称为对称对的一部分作为其他科学学生获得的分数。
【问题讨论】:
-
'对称对' - 那是什么?
-
如果一个学生的科学分数与其他学生的数学分数相等且数学分数相同,则称该学生为对称对的一部分作为其他科学学生获得的分数。
-
@ajeevanshgautam 你不接受我的回答吗?
标签: mysql sql mysql-workbench rdbms