# 1.查找所有住在某个公寓地址为A的所有人的名字
select name from user where department_NO=(select id from department where address="A")
# 2.查找在公寓A中数学成绩最高的同学的名字
select user.name, max(score.math_score) from user, score, department where user.id=score.user_id and user.department_NO=department.id and department.address="A"
# 3.查找在某个公寓中数学成绩最高的同学所在的公寓地址
select department.address,max(score.math_score) from user, score, department where user.id=score.user_id and user.department_NO=department.id
select address from department where id=(select id from score max(math_score)