What is the difference between UNION and UNION ALL?

后端 未结 26 2356
伪装坚强ぢ
伪装坚强ぢ 2020-11-21 11:28

What is the difference between UNION and UNION ALL?

26条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-21 12:00

    UNION ALL also works on more data types as well. For example when trying to union spatial data types. For example:

    select a.SHAPE from tableA a
    union
    select b.SHAPE from tableB b
    

    will throw

    The data type geometry cannot be used as an operand to the UNION, INTERSECT or EXCEPT operators because it is not comparable.

    However union all will not.

提交回复
热议问题