查找山东大学或者性别为男生的信息

 

 题目说了不去重,那就需要使用到   union all :不去重  ,然后分别查询两个条件,山东大学 和 男生 

题目不难,主要是对union得了解和使用,以及题目的审题

具体SQL为,要用到   union all 而不是union

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'

 

posted @ 2021-12-20 09:53  Yapi酱  阅读(50)  评论(0)    收藏  举报