sql中常用union all对数据集进行合并
union 是带去重功能的
or也带去重功能
select device_id, gender ,age ,gpa
from user_profile
where university='山东大学' or gender='male';
使用union代替or,解决or导致全表扫描
select device_id, gender ,age ,gpa
from user_profile
where university='山东大学'
union
select device_id, gender ,age ,gpa
from user_profile
where gender='male';