题解 | #查找山东大学或者性别为男生的信息#
查找山东大学或者性别为男生的信息
https://www.nowcoder.com/practice/979b1a5a16d44afaba5191b22152f64a
--这道题,有点小坑
本来有两种解法,但是因为这道题着重考察union all所以那种方法不能用
其实
用union才与where university = '山东大学',gender = 'male';
这两个才相同,毕竟union与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';
