Loading

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

union合并两个或多个 SELECT 语句的结果集
UNION 内部的 SELECT 语句必须拥有相同数量的列。列也必须拥有相似的数据类型。同时,每条 SELECT 语句中的列的顺序必须相同。

不去重使用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 @ 2022-03-23 09:58  Zhbeii  阅读(56)  评论(0)    收藏  举报