oracle over()º¯Êý¼¼ÊõÏê½â
ÔÎĵØÖ·£ºhttp://hi.baidu.com/zengjl/blog/item/c06c8edeb2c7e45cccbf1aca.html/cmtid/305a850ea57b09ec37d1226c
1.²éѯ±íÊý¾Ý
SQL> select deptno,ename,sal
2 from emp
3 order by deptno;
DEPTNO ENAME SAL
---------- ---------- ----------
10 CLARK 2450
KING 5000
MILLER 1300
20 SMITH 800
ADAMS 1100
FORD 3000
SCOTT 3000
JONES 2975
30 ALLEN 1600
BLAKE 2850
MARTIN 1250
JAMES 950
TURNER 1500
WARD 1250
ÒÑÑ¡Ôñ14ÐС£
2.ÏÈÀ´Ò»¸ö¼òµ¥µÄ£¬×¢Òâover(...)Ìõ¼þµÄ²»Í¬£¬
ʹÓà sum(sal) over (order by ename)... ²éѯԱ¹¤µÄнˮ“Á¬Ðø”ÇóºÍ,
×¢Òâover (order by ename)Èç¹ûûÓÐorder by ×Ӿ䣬ÇóºÍ¾Í²»ÊÇ“Á¬Ðø”µÄ£¬
·ÅÔÚÒ»Æð£¬Ìå»áһϲ»Í¬Ö®´¦£º
SQL> select deptno,ename,sal,
2 sum(sal) over
Ïà¹ØÎĵµ£º
oracle±í¿Õ¼ä²Ù×÷Ïê½â
1
2
3×÷Õߣº À´Ô´£º ¸üÐÂÈÕÆÚ£º2006-01-04
5
6
7½¨Á¢±í¿Õ¼ä
8
9CREATE TABLESPACE data01
10DATAFILE '/ora ......
ËäȻѧϰJavaºÜ¾ÃÁË£¬×Ô¼ºÒ²Á¬½Ó¹ýһЩÊý¾Ý¿â£¬±ÈÈçmysqlÖ®ÀàµÄ£¬Èç½ñÄØ£¬Ò²Ñ§Ï°ÁËÒ»¶Îʱ¼äµÄOracle£¬È»¶øÄØ£¬½ñÌìÊÇÎÒµÚÒ»´ÎÁ¬½ÓOracle£¬ºÙºÙ£¬Ó¦¸Ã»¹²»ËãÌ«³Ù°É¡£
½ñÌìÄØ£¬Óе㱿׾£¬´ó¼ÒĪЦ£¡
ÎÒÕâÊÇÒ»¸ö²éѯÀý×Ó
Ê×ÏÈ£¬Ô ......
¶ÔÓÚrownumÀ´ËµËüÊÇoracleϵͳ˳Ðò·ÖÅäΪ´Ó²éѯ·µ»ØµÄÐеıàºÅ£¬·µ»ØµÄµÚÒ»ÐзÖÅäµÄÊÇ1£¬µÚ¶þÐÐÊÇ2£¬ÒÀ´ËÀàÍÆ£¬Õâ¸öα×ֶοÉÒÔÓÃÓÚÏÞÖƲéѯ·µ»ØµÄ×ÜÐÐÊý£¬¶øÇÒrownum²»ÄÜÒÔÈκαíµÄÃû³Æ×÷Ϊǰ׺¡£
¾ÙÀý˵Ã÷£º
ÀýÈç±í£ºstudent(ѧÉú)±í£¬±í½á¹¹Îª£º
ID¡¡¡¡¡¡ char(6)¡¡¡¡¡¡¡¡¡¡ --ѧºÅ
name¡¡¡¡ ......
IDÊÇÖ÷½¡£¬ÊµÏÖ²åÈëÒ»¸öNAME,ID×Ô¶¯Ôö¼Ó
SQL> create table t1
2 (
3 id & ......
ÔÎĵØÖ·£ºhttp://blog.csdn.net/cnham/archive/2009/08/30/4500928.aspx
oracleµÄ·ÖÎöº¯Êýover ¼°¿ª´°º¯Êý
Ò»£º·ÖÎöº¯Êýover
Oracle´Ó8.1.6¿ªÊ¼Ìṩ·ÖÎöº¯Êý£¬·ÖÎöº¯ÊýÓÃÓÚ¼ÆËã»ùÓÚ×éµÄijÖÖ¾ÛºÏÖµ£¬ËüºÍ¾ÛºÏº¯ÊýµÄ²»Í¬Ö®´¦ÊÇ
¶ÔÓÚÿ¸ö×é·µ»Ø¶àÐУ¬¶ø¾ÛºÏº¯Êý¶ÔÓÚÿ¸ö×éÖ»·µ»ØÒ»ÐС£
ÏÂÃæͨ¹ý¼¸¸öÀý×ÓÀ´ËµÃ÷ÆäÓ ......