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

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

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都可以将多个结果集合并,而不仅仅是两个,你可以将多个结果集串起来。

全部评论

相关推荐

11-06 16:50
门头沟学院 Java
用微笑面对困难:word打字比赛二等奖的我,也要来凑合凑合
点赞 评论 收藏
分享
八极星:有什么不能问的,(/_\),这又不是多珍贵的机会,你有什么可失去的
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务