ITPub博客

首页 > 数据库 > Oracle > UNION-MINUS-INTERSECT-UNIONALL

UNION-MINUS-INTERSECT-UNIONALL

原创 Oracle 作者:13175 时间:2012-09-06 10:55:28 0 删除 编辑

SQL> select * from a;

A
----------
1
2
3

SQL> select * from b;

B
----------
1
4
=========================UNION;列出所有,但重复项只列出一次=========================
SQL> select * from a union select * from b;

A
----------
1
2
3
4
=========================差集;列出不重复的项========================================
SQL> select * from a minus select * from b;

A
----------
2
3
=========================交集;列出重复的项========================================
SQL> select * from a intersect select * from b;

A
----------
1
========================全并集;列出所有的项======================================
SQL> select * from a union all select * from b;

A
----------
1
2
3
1
4

[@more@]

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/14181270/viewspace-1059356/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: timestamp
请登录后发表评论 登录
全部评论

注册时间:2012-02-22

  • 博文量
    52
  • 访问量
    224927