其他sql格式也在更新中,可直接查看这个系列,要是没有你需要的格式,可在评论或私信我
union和union all
sql案例场景
select id as id from a where id=1
union 的案例
- 对两个结果集进行并集操作,不包括重复行,去重
- 会对获取的结果进行排序操作
select id as id from a where id=1
union
select id as id from a where id=1
union all 的案例
- 对两个结果集进行并集操作,包括重复行,不去重
- 不会对获取的结果进行排序操作
select id as id from a where id=1
union all
select id as id from a where id=1
版权声明:本文为zzydan0原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。