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

Oracle Top N ºÍ OracleÖеÄlimitÎÊÌâ½â¾ö·½°¸

oracle top N
1.ÔÚORACLEÖÐʵÏÖSELECT TOP N
   ÓÉÓÚORACLE²»Ö§³ÖSELECT TOPÓï¾ä£¬ËùÒÔÔÚORACLEÖо­³£ÊÇÓÃORDER BY¸úROWNUMµÄ×éºÏÀ´ÊµÏÖSELECT TOP NµÄ²éѯ¡£
¼òµ¥µØ˵£¬ÊµÏÖ·½·¨ÈçÏÂËùʾ£º
      SELECT¡¡ÁÐÃû£±£®£®£®ÁÐÃû£î¡¡from
        (SELECT¡¡ÁÐÃû£±£®£®£®ÁÐÃû£î¡¡from ±íÃû ORDER BY ÁÐÃû£±£®£®£®ÁÐÃû£î)
       WHERE ROWNUM <= N£¨³é³ö¼Ç¼Êý£©
      ORDER BY ROWNUM ASC
   ÏÂÃæ¾Ù¸öÀý×Ó¼òµ¥ËµÃ÷һϡ£
¹Ë¿Í±ícustomer(id,name)ÓÐÈçÏÂÊý¾Ý£º
      ID NAME
       01 first
       02 Second
       03 third
       04 forth
       05 fifth
       06 sixth
       07 seventh
       08 eighth
       09 ninth
       10 tenth
       11 last
   Ôò°´NAMEµÄ×Öĸ˳³é³öÇ°Èý¸ö¹Ë¿ÍµÄSQLÓï¾äÈçÏÂËùʾ£º
      SELECT * from
        (SELECT * from CUSTOMER ORDER BY NAME)
       WHERE ROWNUM <= 3
       ORDER BY ROWNUM ASC
   Êä³ö½á¹ûΪ£º
      ID NAME
       08 eighth
       05 fifth
       01 first
2.ÔÚTOP N¼Í¼Öгé³öµÚM£¨M <= N£©Ìõ¼Ç¼
Ôڵõ½ÁËTOP NµÄÊý¾ÝÖ®ºó£¬ÎªÁ˳é³öÕâNÌõ¼Ç¼ÖеĵÚMÌõ¼Ç¼£¬ÎÒÃÇ¿ÉÒÔ¿¼ÂÇ´ÓROWNUM×ÅÊÖ¡£ÎÒÃÇÖªµÀ£¬ROWNUMÊǼǼ±íÖÐÊý¾Ý±àºÅµÄÒ»¸öÒþ²Ø×ӶΣ¬ËùÒÔ¿ÉÒÔÔڵõ½TOP NÌõ¼Ç¼µÄʱºòͬʱ³é³ö¼Ç¼µÄROWNUM£¬È»ºóÔÙ´ÓÕâNÌõ¼Ç¼ÖгéÈ¡¼Ç¼±àºÅΪMµÄ¼Ç¼£¬¼´Ê¹ÎÒÃÇÏ£ÍûµÃµ½µÄ½á¹û¡£
´ÓÉÏÃæµÄ·ÖÎö¿ÉÒÔºÜÈÝÒ׵õ½ÏÂÃæµÄSQLÓï¾ä¡£
 &nb


Ïà¹ØÎĵµ£º

jdbcÁ¬½ÓOracle

      ËäȻѧϰJavaºÜ¾ÃÁË£¬×Ô¼ºÒ²Á¬½Ó¹ýһЩÊý¾Ý¿â£¬±ÈÈçmysqlÖ®ÀàµÄ£¬Èç½ñÄØ£¬Ò²Ñ§Ï°ÁËÒ»¶Îʱ¼äµÄOracle£¬È»¶øÄØ£¬½ñÌìÊÇÎÒµÚÒ»´ÎÁ¬½ÓOracle£¬ºÙºÙ£¬Ó¦¸Ã»¹²»ËãÌ«³Ù°É¡£
    ½ñÌìÄØ£¬Óе㱿׾£¬´ó¼ÒĪЦ£¡
    ÎÒÕâÊÇÒ»¸ö²éѯÀý×Ó
    Ê×ÏÈ£¬Ô ......

[ת] ½âÎöoracleµÄROWNUM ×÷Õß: chen_liang

¶ÔÓÚrownumÀ´ËµËüÊÇoracleϵͳ˳Ðò·ÖÅäΪ´Ó²éѯ·µ»ØµÄÐеıàºÅ£¬·µ»ØµÄµÚÒ»ÐзÖÅäµÄÊÇ1£¬µÚ¶þÐÐÊÇ2£¬ÒÀ´ËÀàÍÆ£¬Õâ¸öα×ֶοÉÒÔÓÃÓÚÏÞÖƲéѯ·µ»ØµÄ×ÜÐÐÊý£¬¶øÇÒrownum²»ÄÜÒÔÈκαíµÄÃû³Æ×÷Ϊǰ׺¡£
 ¾ÙÀý˵Ã÷£º
ÀýÈç±í£ºstudent(ѧÉú)±í£¬±í½á¹¹Îª£º
ID¡¡¡¡¡¡    char(6)¡¡¡¡¡¡¡¡¡¡ --ѧºÅ
name¡¡¡¡ ......

ORACLE UNDO ¡¶ÉîÈëdz³öORACLEµÚÆßÕ¡·

Èç¹û˵RedoÊÇÓÃÀ´±£Ö¤ÔÚ¹ÊÕÏʱÊÂÎñ¿ÉÒÔ±»»Ö¸´£¬ÄÇôUndoÔòÊÇÓÃÀ´±£Ö¤ÊÂÎñ¿ÉÒÔ±»»ØÍË»òÕß³·Ïú¡£
ÔÚÐ޸IJÙ×÷ÖУ¬¶ÔÓÚ»ØÍ˶εIJÙ×÷´æÔڶദ£¬ÔÚÊÂÎñ¿ªÊ¼Ê±£¬Ê×ÏÈÐèÒªÔڻعö¶Î±í¿Õ¼ä»ñµÃÒ»¸öÊÂÎñ²Û£¬·ÖÅä¿Õ¼ä£¬È»ºó´´½¨Ç°¾µÏñ£¬´ËºóÊÂÎñµÄÐ޸IJÅÄܽøÐУ¬Oracle±ØÐëÒÔ´ËÀ´±£Ö¤ÊÂÎñÊÇ¿ÉÒÔ»ØÍ˵ġ£
Èç¹ûÓû§Ìá½»ÁËÊÂÎñ£¬Oracle»á ......

oracle ·ÖÎöº¯Êýover() £¨Ò»£©

 Ô­ÎĵØÖ·£ºhttp://blog.csdn.net/cnham/archive/2009/08/30/4500928.aspx
oracleµÄ·ÖÎöº¯Êýover ¼°¿ª´°º¯Êý
Ò»£º·ÖÎöº¯Êýover
Oracle´Ó8.1.6¿ªÊ¼Ìṩ·ÖÎöº¯Êý£¬·ÖÎöº¯ÊýÓÃÓÚ¼ÆËã»ùÓÚ×éµÄijÖÖ¾ÛºÏÖµ£¬ËüºÍ¾ÛºÏº¯ÊýµÄ²»Í¬Ö®´¦ÊÇ
¶ÔÓÚÿ¸ö×é·µ»Ø¶àÐУ¬¶ø¾ÛºÏº¯Êý¶ÔÓÚÿ¸ö×éÖ»·µ»ØÒ»ÐС£
ÏÂÃæͨ¹ý¼¸¸öÀý×ÓÀ´ËµÃ÷ÆäÓ ......

oracleÖÐÖ±½ÓÐ޸ıíÁеÄÃû³ÆºÍ˳Ðò

µ¼ÈëÊý¾ÝµÃʱºò£¬Óöµ½Ò»¸öÎÊÌ⣬Ïë°ÑÁÐÃû˳Ðò¸Ä±äһϡ£ÔÚÍøÉÏËÑË÷µ½ÕâƪÎÄÕ£¬Ã»È¥ÊÔÑé¡£ÌùÉÏÀ´£¬ÒÔºóÓлú»áÊÔÑéÏ¡£
£¨http://www.im80hou.com/html/oracle/2009/0710/712.html£©
 
°´ÕÕ¹ØϵÊý¾Ý¿âµÄÀíÂÛ£¬ÐÐÓëÁж¼ÊÇÎÞÐòµÄ£¬µ«ÔÚʵ¼ÊÓ¦ÓÃÖÐÓÐʱÐèҪȷ¶¨ÁеÄ˳Ðò¡£µ«ÔÚOracleÖУ¬Ò»µ©±í¶¨ÒåºÃ£¬ÔÙÏëÐÞ¸ÄÁеÄ˳Ðò¿ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ