Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Oracle ¶à±íÁ¬½Ó×Ó²éѯ

1.Çó²¿ÃÅÖÐÄÄЩÈËнˮ×î¸ß£º
select ename,sal
from emp join
(
    select max(sal) max_sal, deptno
    from emp
    group by deptno
) t
on (emp.sal = t.max_sal and emp.deptno = t.deptno);
2.Çó²¿ÃÅƽ¾ùнˮµÄµÈ¼¶£º
select deptno, avg_sal, grade
from
(
    select deptno, avg(sal) avg_sal
    from emp
    group by deptno
) t join salgrade s
on (t.avg_sal between s.losal and s.hisal);
3.Çó²¿ÃÅƽ¾ùµÄнˮµÈ¼¶£º
select deptno, avg(grade)
from (
    select deptno, ename, grade
    from emp join salgrade s
    on emp.sal between s.losal and s.hisal
) t
group by deptno;
4.ÇóÄÄЩÈËÊǾ­ÀíÈË£º
select ename from emp where empno in (select distinct mgr from emp);
5.²»×¼Óþۼ¯º¯Êý£¬ÇóнˮµÄ×î¸ßÖµ£º
select distinct sal
from emp
where sal not in
(
    select distinct e1.sal
    from emp e1 join emp e2 on (e1.sal < e2.sal)
);
6.Çóƽ¾ùнˮ×î¸ß²¿ÃŵIJ¿ÃűàºÅ£º
select deptno, avg_sal
from (
    select deptno, avg(sal) avg_sal
    from emp
    group by deptno
) where avg_sal = (
    select max(avg_sal)
    from (
        select deptno, avg(sal) avg_sal
        from emp
        group by deptno
    )
);
7.Çóƽ¾ùнˮ×î¸ß²¿ÃŵIJ¿ÃÅÃû³Æ£º
select deptno,dname
from dept
where deptno = (
    select deptno
    from (
        select deptno, avg(sal) avg_sal
        from emp
        group by deptno
    ) where avg_sal = (
        select max(avg_sal)
     


Ïà¹ØÎĵµ£º

oracle ±í¿Õ¼ä²Ù×÷

oracle±í¿Õ¼ä²Ù×÷Ïê½â
  1
  2
  3×÷Õߣº   À´Ô´£º    ¸üÐÂÈÕÆÚ£º2006-01-04 
  5
  6 
  7½¨Á¢±í¿Õ¼ä
  8
  9CREATE TABLESPACE data01
 10DATAFILE '/ora ......

ѧϰ¡¶Oracle 9i10g±à³ÌÒÕÊõ¡·µÄ±Ê¼Ç (Îå)

 1.¾¡¿ÉÄܵØʹÓð󶨱äÁ¿ ²»Óÿª¹ØCURSOR_SHARING=FORCE 
Èç¹ûÄãÔ¸Ò⣬Õâ¸öÌØÐÔ»áʵÏÖÒ»¸ö×Ô¶¯°ó¶¨Æ÷£¨auto-binder£©¡£
Èç¹ûÓÐÒ»¸ö²éѯ±àдΪSELECT * from EMP WHERE EMPNO = 1234£¬×Ô¶¯°ó¶¨Æ÷»áÇÄÎÞÉùÏ¢µØ°ÑËü¸Äд³É
SELECT * from EMP WHERE EMPNO = :x¡£ÕâȷʵÄܶ¯Ì¬µØ´ó´ó¼õÉÙÓ²½âÎöÊý£¬²¢¼õÉÙÇ°ÃæÌÖÂÛµ ......

¹ØÓÚORACLE¸¨ÖúÓï¾ä

--JOBS
DECLARE
X NUMBER;
BEGIN
SYS.DBMS_JOB.SUBMIT(job => X,
what => 'sp_test();',
next_date => to_date('28-04-2009 11:58:00',
'dd/mm/yyyy hh24:mi:ss'),
interval => 'SYSDATE+1');
END;
/
commit;
select to_char(sysdate-90,'yyyymmdd') from dual;  --Ñ¡ÔñÈÕÆÚ
select * from ......

aixÏ°²×°oracleÐĵÃ

ɾ³ýAIXϵÄORACLE
===========================================================
×÷Õß: wmlm(http://wmlm.itpub.net)
·¢±íÓÚ:2008.12.02 18:17
·ÖÀà: oracle
³ö´¦£ºhttp://wmlm.itpub.net/post/12871/474762
---------------------------------------------------------------
rm -Rf /etc/oratab
rm -Rf /et ......

OracleËæ»úº¯ÊýµÄÓ÷¨

 ÈÝÒ×µÃ˵£¬¾­¹ýdbms_random°üµ÷ÓÃËæ»úÊýµÄ²½Öè´óÌåÓÐ4ÖÖ£º
Ò»¡¢dbms_random.normal
Õâ¸öº¯Êý²»´ø²ÎÊý£¬»á»Øµ½normal distributionµÄÒ»¸önumberÃÅÀ֮࣬ËùÒÔ´óµÖËæ»úÊý»áÔÚ-Ò»µ½Ò»Æä¼ä¡£
¼òÂÔ²âÊÔÁËÒ»ÏÂ×Ó£¬·¢×÷100000´Î×î´óÄܵ½ÎåÉÏÏ£º
SQL> declare
¶þ i number:=Áã;
Èý j number:=Áã;
ËÄ begin
Îå for ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ