而我们要找出有店面营业额以及网络营业额的日子。要达到这个目的,我们用以下的SQL语句:

以下为引用的内容:

SELECT Date FROM Store_Information
UNION ALL
SELECT Date FROM Internet_Sales 结果:  
Date 
Jan-05-1999 
Jan-07-1999 
Jan-08-1999 
Jan-08-1999 
Jan-07-1999 
Jan-10-1999 
Jan-11-1999 
Jan-12-1999

============

表1
A   B
a   1
b   0
c   3
d   0
e   2
表2
A   B
c   0
e   4

合并两个表除去重复的数据(以表2的数据为主),我们将会得到以下的表:

以下为引用的内容:

A   B
a   1
b   0
c   0
d   0
e   4

select A,B from 表1 where A not in(select A from 表2)
union
select A,B from 表2