Home > Database > Mysql Tutorial > body text

Oracle minus使用

WBOY
Release: 2016-06-07 16:22:41
Original
1833 people have browsed it

新建两个表: create table guotest1 ( sName varchar2(10), Gender varchar2(10) ) create table guotest2 ( sName varchar2(10), Gender varchar2(10) ) 插入数据: insert into guotest1 values('a', 'm'); insert into guotest1 values('b', 'm'); inser

   新建两个表:

  create table guotest1

  (

  sName varchar2(10),

  Gender varchar2(10)

  )

  create table guotest2

  (

  sName varchar2(10),

  Gender varchar2(10)

  )

  插入数据:

  insert into guotest1 values('a', 'm');

  insert into guotest1 values('b', 'm');

  insert into guotest1 values('c', 'f');

  insert into guotest1 values('d', 'f');

  insert into guotest2 values('e', 'm');

  insert into guotest2 values('f', 'm');

  insert into guotest2 values('g', 'f');

  insert into guotest2 values('h', 'f');

  1 minus返回的是两个查询结果表的差集

  例如:select * from guotest1 where rownum

  返回结果:

  "SNAME","GENDER"

  "c","f"

  "d","f"

  2 minus返回的记录总是来自于左边的表

  例如:select * from guotest1 minus select * from guotest2

  返回结果:

  "SNAME","GENDER"

  "a","m"

  "b","m"

  "c","f"

  "d","f"

  像是说:如果左边的表中的某个记录存在于右边的表中,,则该记录不会返回

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template