对一个表执行多个查询,按一个查询返回数据:
select 属性集合0 form 表0 where 逻辑组合0
union
select 属性集合0form 表0 where 逻辑组合1 等价于 select distinct 属性集合0
form 表0 where 逻辑组合0 or 逻辑组合1
union:返回的是一个集合,不能含有相同的值
可以看出某些方面where与union之间可以相互转换
属性集合0与属性集合0`中列的类型不一定需要都相同(DBMS有一定的类型转换功能)
select 属性集合0 form 表0 where 逻辑组合0
union
select 属性集合0form 表0 where 逻辑组合1 等价于 select 属性集合0
form 表0 where 逻辑组合0 or 逻辑组合1
union all:返回的结果,可以有相同的值