易截截图软件、单文件、免安装、纯绿色、仅160KB

oracle exists and not exist


先看下面的例子:oracle中两个系统表.emp,dept.
example:
1:not exists(not in)
not exists:
   这条语句返回select * from scott.dept d where e.deptno=d.deptno and d.deptno=10条件满足的结果集.也就是说,
返回的结果集中不存在d.deptno=10结果集的记录,即emp表中没有dept表中d.deptno=10的记录.
SQL> select empno,ename,deptno from scott.emp e where not exists(select * from scott.dept d where e.deptno=d.deptno and d.deptno=10);
EMPNO ENAME      DEPTNO
----- ---------- ------
 7369 SMITH           20
 7499 ALLEN           30
 7521 WARD           30
 7566 JONES           20
 7654 MARTIN         30
 7698 BLAKE           30
 7788 SCOTT           20
 7844 TURNER         30
 7876 ADAMS          20
 7900 JAMES           30
 7902 FORD            20
11 rows selected
not in:
第一个where条件必须给定字段(deptno), 第二个sql语句中,必须明确给定要查询的字段是哪个(deptno).
SQL> select empno,ename,deptno from scott.emp e where deptno not in(select deptno from scott.dept d where e.deptno=d.deptno and d.deptno=10);
EMPNO ENAME      DEPTNO
----- ---------- ------
 7369 SMITH           20
 7499 ALLEN           30
 7521 WARD           30
 7566 JONES         


相关文档:

oracle表空间查询

1.查询用户(数据)表空间
SELECT UPPER(F.TABLESPACE_NAME) "表空间名",
       D.TOT_GROOTTE_MB "表空间大小(M)",
       D.TOT_GROOTTE_MB - F.TOTAL_BYTES "已使用空间(M)",
       TO_CHAR(ROUND((D.TOT_GROOTTE_ ......

oracle 物化视图

物化视图是一种特殊的物理表,“物化”(Materialized)视图是相对普通视图而言的。普通视图是虚拟表,应用的局限性大,任何对视图的查询,Oracle都实际上转换为视图SQL语
句的查询。这样对整体查询性能的提高,并没有实质上的好处。
  Oracle最早在OLAP系统中引入了物化视图的概念。但后来很多大型OLTP系统中 ......

oracle 存储过程实例


/*不带任何参数存储过程(输出系统日期)*/
create or replace procedure output_date is
begin
dbms_output.put_line(sysdate);
end output_date;
/*带参数in和out的存储过程*/
create or replace procedure get_username(v_id in number,v_username out varchar2)
as
begin
  select username into v_usern ......

Oracle TNS简述

Oracle TNS简述
 什么是TNS?
TNS是Oracle Net的一部分,专门用来管理和配置Oracle数据库和客户端连接的一个工具,在大多数情况下客户端和数据库要通讯,必须配置TNS,当然在少数情况下,不用配置TNS也可以连接Oracle数据库,比如通过JDBC.如果通过TNS连接Oracle,那么客户端必须安装Oracle client程序.
TNS有那些配置文件 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号