Oracle¸ß¼¶²éѯ
ʹÓÃOracleÌØÓеIJéѯÓï·¨, ¿ÉÒԴﵽʰ빦±¶µÄЧ¹û
1. Ê÷²éѯ
create table tree (
id number(10) not null primary key,
name varchar2(100) not null,
super number(10) not null // 0 is root
);
-- ´Ó×Óµ½¸¸
select * from tree start with id = ? connect by id = prior super
-- ´Ó¸¸µ½×Ó
select * from tree start with id = ? connect by prior id = super
-- Õû¿ÃÊ÷
select * from tree start with super = 0 connect by prior id = super
2. ·ÖÒ³²éѯ
select * from (
select my_table.*, rownum my_rownum from (
select name, birthday from employee order by birthday
) my_table where rownum < 120
) where my_rownum >= 100;
3. ÀÛ¼Ó²éѯ, ÒÔscott.empΪÀý
select empno, ename, sal, sum(sal) over(order by empno) result from emp;
EMPNO ENAME SAL RESULT
---------- ---------- ---------- ----------
7369 SMITH 800 800
7499 ALLEN &
Ïà¹ØÎĵµ£º
²»ÊÇORACLEµÄÎÊÌâ
2009-12-30 15:00
  ......
Èç¹ûÔÚÊÂÎñÖÐÖ´ÐÐÁËÒ»Ìõ²»Âú×ãÌõ¼þµÄupdateÓï¾ä£¬ÔòÖ´ÐÐÈ«±íɨÃ裬°ÑÐм¶ËøÉÏÉýΪ±í¼¶Ëø£¬¶à¸öÕâÑùµÄÊÂÎñÖ´Ðк󣬾ͺÜÈÝÒײúÉúËÀËø¡£
ËÀËøÒ»°ãÊÇÒò×¾ÁÓµÄÊÂÎñÉè¼Æ¶ø²úÉú insert, update, delete
1.°´Óû§Óëϵͳ»®·Ö£¬¿ÉÒÔ·ÖΪ×Ô¶¯ËøÓëÏÔʾËø
×Ô¶¯Ëø£ºµ±½øÐÐÒ»ÏîÊý¾Ý¿â²Ù×÷ʱ£¬È±Ê¡Çé¿öÏ£¬ÏµÍ³×Ô¶¯Îª´ËÊý¾Ý¿â²Ù×÷»ñµÃËùÓ ......
oracle 9i online documentation:
http://www.oracle.com/pls/db92/db92.docindex?remark=homepage
oracle 10g online documentation:
http://www.oracle.com/pls/db102/homepage
oracle 11g online documentation:
http://www.oracle.com/pls/db111/homepage ......
lob×ֶβ»ÄÜ×ögroup by£¬¶øunionÖÐÐèҪʹÓÃgroup by¹ýÂ˵ôÖظ´¼Í¼£¬ËùÒÔ²»ÐÐ ¡£ ÓÃunion all¾Í¿ÉÒÔÁË¡£
Áí£ºunion ºÍ union allÇø±ð£º
UNIONÔÚ½øÐбíÁ´½Óºó»áɸѡµôÖظ´µÄ¼Ç¼£¬ËùÒÔÔÚ±íÁ´½Óºó»á¶ÔËù²úÉúµÄ½á¹û¼¯½øÐÐÅÅÐòÔËË㣬ɾ³ýÖظ´µÄ¼Ç¼ÔÙ·µ» ......