在集合论中,两个集合(集合A和集合B)的并集是一个包含集合A和B中所有元素的集合。换句话说,如果一个元素属于任何一个输入集合,那么它也属于结果集。如图所示。

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAYUAAAFHCAIAAADBYcegAAAQwUlEQVR4nO3czWGrOBSGYQq6FbiIKcPLaWQ2LuNW4AZSRorRLPwnQGBAR+g70vssE8fIB/QGO3dmCACgYai9AAB4okcAVNAjACroEQAV9AiACnoEQAU9AqCCHgFQQY8AqKBHAFRs6tEAAJvRIwAq6BEAFSf16PBhADSPHgFQQY8AqKBHAFTQIwAq6BEAFfQIgAp6BEAFPQKggh4BUEGPAKigRwBU0CMAKugRABX0CIAKegRABT0CoIIeAVBBjwCooEcAVNAjh35vl2EYhsvtt/ZKAFP06HzPnAzXe/zV+3XYGpnzevRc1Oqxdr+c95NGxj+MXtGj82X36DRROZbXZdIjkoQQ6FENbnr0WNLlklrux9Eevb71+nmlV45K6NH5tmzgz1uy16OjH5i/XxvfckTfWH2eV3AWQvD+7vPZF4Jk1CNyBHpUw54eXd4RiX5kvIOj0Mweuf48r4olUxAfZDVIFu/XeK+GEAI9qmFHj94Peu3h6z2MUzF94OTtz+rzrN0fjZu3FiSjz4+4PwI9qmF1A0/ua96bNP524tYl3s3xl1afZ8caV/Ky5eWExLfez8UHSHihRxWkNvdkVxv0aPbQ2TeXpd8DLjRjw8tZf/zag9EVelTBe7fPbhGWP7Jeisy292sLPVp6v7bwF/mFIG14Oalnfz969WMsdIUeVbGw4We3DN97tPRcW+6zlkIw/pBpvKI9/6JoITD7Ho2e0KNqJttyvB139Gj+XFFHjtwfJXO08vUNL2ftkSvPid7QIwAq6BEAFfQIgAp6BEAFPQKggh4BUEGPAKigRwBU0CMAKugRABX0CIAKegRABT0CoIIeAVBBjwCooEcAVNAjACroEQAV9AiACnoEQAU9AqCCHgFQQY8AqKBHAFTQIwAq6BEAFfQIgAp6BEAFPQKggh4BUEGPAKigRwBU0CMAKugRABX0CIAKegRABT0C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2eXfwub9X/tSW/CB70Ze/2a38E4PRJNber0UvYzK6LV/Zv2Z4RI/mNlzo5/UovvUZ3Qbdr5+bpoWfXvje5n9qGXcmu0fJH0h+IfWl/WuGR/Ro7rWP4rcHe/+F3/ZDrX6ePQzJD4umK1346S23D4/Ppq7Pt6gLP2Hco+mHQLMJfBnvpjXDI3o0l9hHnzQ9vnPy39cWrD3ia49GuZsk+Ou/c1y+jxp/J/0v20d/K9x0D3VgzfCIHs1J/Pdra7WJFri4iOUejT4R/3xtdtMyLP5ha3GVS/dHo4mu/1vN9Es/sGZ4RI/mRD4/ArpDjwCooEcAVNAjACroEQAV9AiACnoEQAU9AqCCHgFQQY8AqKBHAFTQIwAq6BEAFfQIgAp6BEAFPQKggh4BUPE/GEl4b3jMa6AAAAAASUVORK5CYII=" alt="" />

  对于集合运算,需要注意以下几点:

  1. 参与集合运算的两个查询生成的结果集必须包含相同的列数,并且相应列必须具有兼容的数据类型。
  2. 集合运算结果中的列名由第一个查询决定,因此,如果要为结果列分配别名,应该在第一个查询中分配相应的别名。
  3. 集合运算对行进行比较时,认为两个NULL值相等。

UNION集合运算分为UNION ALL和UNION DISTINCT两种情形,它们的区别是UNION ALL会保留重复行,而UNION DISTINCT会删除重复行。下面用例子来说明。

UNION ALL

UNION ALL合并两个集合,并保留重复行。关于UNION ALL需要注意以下几点:

  1. UNION ALL实际上不会对行进行比较,也不会删除重复行,它只是做个合并的操作而已。
  2. 因为UNION ALL不会删除重复行,所以它的结果是多集,而不是真正的集合,因为相同的行在结果中可能出现多次。

例如。

SQL查询代码:

USE TSQLFundamentals2008;
GO -- UNION ALL合并两个集合,并保留重复行
SELECT country,region,city FROM HR.Employees
UNION ALL
SELECT country,region,city FROM Sales.Customers

查询结果:

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAhoAAAEOCAIAAABAdClhAAAgAElEQVR4nO2dfYwcxZ33S4845S6PQh7lj+TE6RJHhEdIHBJ3a6/GI6LjeCQ/Do/O3ClClhwT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5IdCaXI8jJ4nfX0x+glD/c0+7vTjo3/G6ciI8ior1w3QnsuIj3NGC+sCMSjc66nGff2UnfX7K4ed2eJ/6X/MxZOQn040pR2vRH8p99+QuNH8qE+VV8B0bYX8Uj2o2AvznQNOI/Dazv4518+XRcdNzlXD3cSx1Hftf1tY7IfH7Pt2nCK3fcYr/CC+/sotFx5x9CRuA0SEd04nGce+sJ+nvAhdf+t/JkuFF56ZH5pzcvbl5neW25XzAMOaHRiecfIvbAaZCO6NDj2Pj1yf/46+QNTnxi7q0n6o9toI8yW7GcvZXz8nzICY0OPf8Q8QZOg3REpx7HD/eU/9vn6d2I+ve+WT3cy5q9JxyVVx6tf//eG9/4siUhK3fcUn9sQ/VwL+ddwjQgJwgEAqFJzL731OLmdZYNInX2Xdh1f5K6UnnpEWreZSVQ//69cGNEIBCIzovZ956af3rz0v13sc36cvbW+mMbqoMPS931/J5vW7ub3/NtoVMWN/zkBAAAgFIqv/3t4pYtn33xi5aufPaVryzs3Dn7/vvRN179t3+bP3iwvmPH4pYty3ff/dlXvmISYv7pn84fPBhug3w5AQAAoA+/+qd/envLlqm777Z05dzf/M0bvb2/3rHj+Z/9zH/dX+/Y8esdO05u2/bOP/zD1N13X7r99sXPf569td64O/Inf3LhzjtHnnwySp4NOfkZAAAAvfk/Tz315saNs1/6kksMajfffP4b37CidvPNXsFgY+Yv/uL3d9755saNr/3jP774yCP/94knYkySmAAAADqFl182d+40N24077nH/PM/FyrHmjXmPfeYGzeaO3eaO3eaL79snj4tOzUye/UqAoFAIDo05s6erY2MVN58U3km/x+YfvohglGyHwAAAABJRU5ErkJggg==" alt="" />

UNION DISTINCT

UNION DISTINCT会合并两个集合,但是它会删除重复行。对于UNION DISTINCT需要注意以下几点:

  1. 从处理过程来看,UNION DISTINCT先合并多个集合为多集,再删除重复行变成集合。
  2. 从运算结果来看,UNION DISTINCT是一个真正的集合,而不是多集。

例如。

SQL查询代码:

USE TSQLFundamentals2008;
GO -- UNION(隐含DISTINCT)合并两个集合,但会删除重复行
SELECT country,region,city FROM HR.Employees
UNION
SELECT country,region,city FROM Sales.Customers

查询结果:

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAhwAAAEOCAIAAABNalkmAAAgAElEQVR4nO2dbWwcx53m60OAILdI4MsBRrBAcgoc4wysgxNAiWjxkoO9HwxngZNx2PNpL5Ejacg04kMWCGIkpv0hgpRzKFMjmDlANia4JDxA8kusSKQCTA4wEsne1co2ZyWLpChbDCPbkiWLkqwhOUOOKMp9H/qturqqp6e7eqpm+vmhQDR7+uVf1d31TFX11EPWKEZHR6vV6ujo6DwAAAABVzuBBPmqto6nGp6OEK6oAAAAAHFoLioAAABAfCAqAAAApAFRAQAAIA2ICgAAAGk0EZVni/s7NKkuWAAAyCPNRcXqQCAqAACghK4VFf2T6ksPAADy6VpRWdMbiAoAoCtJLipmqcJNPSab2iknNs8W9y8GOX78+PHjx48GGR09sKgCiAoAoFtJJSqliuWkkmUKUrSoEEIi/pUoKqUSG8b8/LxZKkFUAABAIjJbKuE2So9Z6elJJSpETLSoLATxRGVhYaFy3apct158u2qapQUV3L59G6ICAOhKkosK/d1/YmLCWz5+/Li90Gg0SqVKT4/ZVFEiNIMWD9EyV1SYfNrRnjt3rlKpTExMvPh2tVSqmGYpTdkRQhJ8VK1WISoAgG5Fjqh4QmJZ1tGjR21FsdsHmzZtaqooEVKRuKVyM0ipVClVKkePHi2VKqOjB+xkmqWbsSGExFkQQR8KogIA6FaSi8ro6IFz585NTEwcD2JX3PYweLSohLWBKypNl7miciNIeEzlxberTpOlUilVKnNzczeaQQihF+i/zAaiHW1WV1chKgCAriSVqHjLdEulVKrYIweV69bo6AGRqDDaIGqFJG6pXA9SKlUuXrxo+wRUKtaLb1dffLtKx9zTY87NzV1vBUJIeI0IejOICgCgW5Hc/dVoNI4ePeoNhkeLSrQwpNn+2eL+a0FKpcrc3FygOVWp2NmwSmapVJmYmLB15RoPQgi9HCa8mWj3a9euQVQAAN1KclF5/vnnK5WKXUd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S7XcSRL732o8YTDy0/t8UbbmkU/kPovm1SjXBv2ipPVJZe+9Gdr91tEVI7KP5VGZPiTdMirkAj35vqkBQ1oFKN83o4UowUet+xw5Lc24D68o7U1tS5j3M48uXnttg/S7zz5S82fvC39Re2Lrz7s9gHpEWF9+vLC3vsn15ahKz9zV+3EGocUWnhF/UdmJL+oh6p1RTzNwqaJvm3gffdvJMfn45Lnfs4cyNffOMn9jTGXlp9+P6VXY/UDj3ewhSQoeTNe//p3Z9f2fWI/evLuAkTSia7lkh5S7gNuiN17nWMiHzxrafrv95+67ub7BmF6fTpFz63+sj65ee2xG/ELO/5e/s4t/vuaaXp4yaISppriZSfhNugO1LnXsdYkV/YUzv0+MrTf3dry8bbfffYwyFO+uxnbn130/JzW2qHHmdS44mH7HT7wfvs/rQWfpUSThAVOdcSqdsTboPuSJ17HRNGfmFP/dfbb23Z6KlFk/TZz6w+fL/9UlnCBFFBQkJC6vq08O7PagcHGk88tPrI+tt999ip8b1ves0UuxEj4VwQFSQkJCQkaam5qAAAAACxiRIVAAAAoFV8UfkFAAAAIAliAQAAAJIgCzduICEhISEhSUkQFSQkJCQkaen/AzBmeHVtiMxHAAAAAElFTkSuQmCC" alt="" />

注意:比上面的查询少了29条记录,当然这些记录都是因为重复行被删除了。

UNION并集运算的更多相关文章

  1. 集合运算—union(并集)、intersect(交集)和except(差集)

    一.集合运算的基本格式是: 集合查询1 <集合运算> 集合查询2 [order by ...] 二.集合运算符是对两个集合操作的,两个集合必须具有相同的列数,列具有相同的数据类型(至少能隐 ...

  2. 内链接、左右连接、union并集

    第一个:内连接接 inner join select   *   from   a   inner   join   b   on   a.id=b.id where a.id =b.id (这种用法 ...

  3. Intersect交集Except差集Union并集实例

    int[] oldArray = { 1, 2, 3, 4, 5 };int[] newArray = { 2, 4, 5, 7, 8, 9 };var jiaoJi = oldArray.Inter ...

  4. 《MSSQL2008技术内幕:T-SQL语言基础》读书笔记(上)

    索引: 一.SQL Server的体系结构 二.查询 三.表表达式 四.集合运算 五.透视.逆透视及分组 六.数据修改 七.事务和并发 八.可编程对象 一.SQL Server体系结构 1.1 数据库 ...

  5. SQL Server系列

    这里整理了我学习SQL Server的全部文章,包括从基础到高级,做一个目录,方便以后查找. SQL Server数据类型 SQL Server中开发常用的数据类型 单表查询和多表查询 一个单表查询的 ...

  6. python3集合练习(set)

    #集合是由不同元素组成;无序;集合中的元素必须是不可变类型;#s = {} 或者 s = set() 创建集合#update()扩展集合.返回值为Noneg1 = {'wcj','good','luc ...

  7. python学习笔记:第7天 深浅拷贝

    目录 1. 基础数据类型补充 2. set集合 3. 深浅拷贝 1. 基础数据类型补充 (1)join方法 join方法是把一个列表中的数据进行拼接,拼接成字符串(与split方法相反,split方法 ...

  8. android clipRect Op.xxx各个参数理解

    有点小啰嗦的一篇学习笔记,可以直接看最后得出的结论:前面的各种图片和说明都是为最后的结论服务的 1)剪切:和平常画图工具剪切的作用一样,在画布上剪切一个区域,比如剪切一个Rect区域,画布canvas ...

  9. UNION(并集)集合运算

    在集合论中,两个集合(记为集合A和B)的并集是一个包含集合A和B中所有元素的集合.换句话说,如果一个元素属于任何一个输入集合,那么它也属于结果集. 在T-SQL中,UNION 集合运算可以将两个输入查 ...

随机推荐

  1. STL之容器(1)

    STL容器类的模板 容器部分主要由头文件<vector>,<list>,<deque>,<set>,<map>,<stack>和 ...

  2. 内存缓存机制and垃圾回收机制

    一.内存缓存机制 var_dump(memory_get_usage(true)); $a="laruence"; var_dump(memory_get_usage(true)) ...

  3. 使用Scala实现Java项目的单词计数:串行及Actor版本

    其实我想找一门“具有Python的简洁写法和融合Java平台的优势, 同时又足够有挑战性和灵活性”的编程语言. Scala 就是一个不错的选择. Scala 有很多语言特性, 建议先掌握基础常用的: ...

  4. Super Ugly Number

    eg 2,3,5 把第一个元素(2,1)放到最小堆,2表示乘积,1表示乘数   乘数     队列                          最小堆                   即将进 ...

  5. python—面向对象编程

    面向对象编程简单来说就是基于对 类 和 对象 的使用,所有的代码都是通过类和对象来实现的编程就是面向对象编程! 面向对象的三大特性:封装.继承.多态 首先创建一个类 #使用class创建一个Schoo ...

  6. Linux+I2C总线分析(主要是probe的方式)

    Linux I2C 总线浅析 ㈠ Overview Linux的I2C体系结构分为3个组成部分: ·I2C核心: I2C核心提供了I2C总线驱动和设备驱动的注册.注销方法,I2C通信方法(即“algo ...

  7. LR java Vuser 相关依赖JAR包,配置文件处置方法

    JAR包,配置文件依赖有两种处理方法 1.放到工程文件夹下(lr脚本目录),不支持负载机调用 2.F4  classpath设置加载jar包和配置文件的整个文件夹,麻烦些,但支持负载机调用(与http ...

  8. iOS开发中的内存分配(堆和栈)

    进程的内存分区 所有进程(执行的程序)都必须占用一定数量的内存,它或是用来存放从磁盘载入的程序代码,或是存放取自用户输入的数据等等.不过进程对这些内存的管理方式因内存用途不一而不尽相同,有些内存是事先 ...

  9. javascript 常用实用函数。。。。。。

    javascript 正则表达式 1.获取屏幕大小尺寸 /* 获取屏幕大小尺寸 */ var getScreen = function () { var screen = { width: 0, he ...

  10. Mysql常用数据类型

    Mysql常用数据类型 数字: 字符串: 时间: