日期:2014-05-16  浏览次数:20484 次

union all 和 union 的区别
SQL>   select   *   from   a;

ID                   NAME
----------   ----------
1                     aa
2                     bb
3                     cc
6                     dd
7                     ee

SQL>   select   *   from   b;

ID                   ADDR
----------   ----------
1                     aa
2                     bb
3                     cc
4                     dd
5                     ee

SQL>   select   *   from   a
    2     union   all
    3     select   *   from   b;

ID                   NAME
----------   ----------
1                     aa
2                     bb
3                     cc
6                     dd
7                     ee
1                     aa
2                     bb
3                     cc
4                     dd
5                     ee

已选择10行。

SQL>   select   *   from   a
    2     union  
    3     select   *   from   b;

ID                   NAME
----------