SQL中有两个变量的联合是什么?

时间:2015-03-13 00:31:50

标签: sql

有人可以向我解释这个问题究竟是什么问题而我没有完全给出答案吗?我想学习。

Let A={kirk,spock,mccoy} and B={spock,scotty,sulu}. What is A Union B?
Let A={Kirk,Spock,Mccoy} and B={Spock,Scotty,Sulu} what is A intersect B
Let A={Kirk,Spock,mccoy} and B={Spock,Scotty,Sulu}. What is A except B

2 个答案:

答案 0 :(得分:1)

Union意味着您正在查看将两个集合的所有元素放入新集合时产生的集合。

请注意,集合只出现任何给定元素

如果你有BridgeOfficers = {Kirk,Spock}和科学家= {Spock,McCoy},那么

BridgeOfficers Union科学家将成为{Kirk,Spock,McCoy}和 {Kirk,Spock,Spock,McCoy}

答案 1 :(得分:1)

什么是A UNION B?

The result considering A and B have the same number of columns,  
both of the result will be merged into on a single result set.

什么是INTERSECT B?

The result will be what both A and B have, can be similar to  
INNER JOIN and other similar solution/work around.

什么是B除外?

The result will be all the values of A that B does not have, can  
be similar to LEFT JOIN combined with filtering.

很好的例子:Example .pdf link
积分给.pdf

的所有者