题解 | #查找山东大学或者性别为男生的信息#
查找山东大学或者性别为男生的信息
https://www.nowcoder.com/practice/979b1a5a16d44afaba5191b22152f64a
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'
其实这里的不去重表示:只要满足一个条件就被筛选出来,但总会存在一个人满足了两个条件只筛选一次。这里的坑是使用or,因为or自带去重,而union等价于or,但union all 可以不去重,所以本体考察or与union的细节使用。