题解 | #查找山东大学或者性别为男生的信息#
查找山东大学或者性别为男生的信息
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';
# 不会的原因主要是不知道这union all的用法
# 如果我们需要将两个select语句的结果作为一个整体显示出来,我们就需要用到union或者union all关键字。union(或称为联合)的作用是将多个结果合并在一起显示出来。
# union 和 union all都可以将多个结果集合并,而不仅仅是两个,你可以将多个结果集串起来。
查看26道真题和解析

