HQL---union all 与union 的区别
union all 与 union 的相同之处
使用union all 或者 union时,要求表中的字段类型相同,且字段个数相同
union all 与 union 的不同之处
union all :对两个结果集取并集,结果集不去重;
union:对两个结果集取并集,结果集去重
实际操作
student_pf中的数据如下图所示:
select * from student_pf where city=‘beijing’ union all select * from student_pf where city=‘beijing’;
select * from student_pf where city=‘beijing’ union select * from student_pf where city=‘beijing’;