题解

  1. 此题是查询学生学校为山东大学或者性别为男的数据。我们可以考虑用户or。
  2. 但是要求,不去重,也就是说如果为男的数据或者学校为山东大学的数据都查询出来,存在有的人是山东大学并且性别为男,使用or的话,就会出现去重的情况。因此我们要考虑把两种情况给合并起来。可以考虑使用union all。

答案

select 
    device_id, gender, age, gpa
from user_profile
where university='山东大学'

union all

select 
    device_id, gender, age, gpa
from user_profile
where gender='male'