Bo's Oracle Station

查看: 1182|回复: 0

成对比较(限定更强)和不成对比较:

[复制链接]

1005

主题

1469

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
12012
发表于 2020-9-13 20:37:53 | 显示全部楼层 |阅读模式
  1. create table t071fi08_pair ( number#   number,   a varchar2(20), b number );

  2. insert into  t071fi08_pair values (1, 'A' ,1);
  3. insert into  t071fi08_pair  values (2, 'A' ,1);
  4. insert into t071fi08_pair  values (3, 'A' ,2);
  5. insert into  t071fi08_pair values (10, 'B' ,2);
  6. insert into  t071fi08_pair  values (20, 'B' ,2);
  7. insert into t071fi08_pair  values (30, 'B' ,1);
  8. commit;

  9. select * from t071fi08_pair;



  10. commit;

  11. select  * from  t071fi08_pair;


  12. select *
  13.    from  t071fi08_pair
  14.     where (a,b)  in (select a,b from t071fi08_pair where number#
  15.            in ( 1,10))        
  16.       and   number# not in (1,10);   
  17.      
  18.    
  19.     select *
  20.        from       t071fi08_pair
  21.        where a in ( select  a from   t071fi08_pair where  number#
  22.            in ( 1,10))
  23.          and         
  24.             b in  ( select  b from  t071fi08_pair   where number#
  25.            in ( 1,10))         
  26.            and  number# not in (1,10);
复制代码
  1. UPDATE
  2. SET
  3. employees
  4. (job_id,salary) = (SELECT job_id,salary
  5. FROM
  6. employees
  7. WHERE
  8. employee_id = 205)
  9. WHERE
  10. employee_id
  11. = 103;
复制代码


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|Bo's Oracle Station   

GMT+8, 2024-5-3 04:31 , Processed in 0.037940 second(s), 24 queries .

快速回复 返回顶部 返回列表