Select class 中年龄最大的学生姓名,使用 EXISTS 运算符

Select name of the oldest student in the class using EXISTS operator

我完全迷失在这个问题上。 table 有学生的出生日期,我可以使用 Exists 子句来获取最年长的学生。

我能够使用 MIN(dateofbirth) 来获取最年长的人,但我可以在 exists 子句中找出​​

谢谢

您要做的是使用 WHERE NOT EXISTS 来确保没有出生日期更早的学生:

SELECT s1.student_id, s1.birth_dt
  FROM studenttable s1
 WHERE NOT EXISTS ( SELECT 1 FROM studenttable s2
                     WHERE s2.birth_dt < s1.birth_dt );