oracle·ÖÒ³¾ÍÓÃÕâÒ»¾ä
·ÖÒ³µÄ×ÚÖ¼ÊÇ¿ØÖƲéѯ³öÀ´µÄÊý¾Ý¸öÊý£¬ÏÂÃæÕâÌõÓï¾ä¶ÔÓÚOracle·ÖÒ³ÒѾ×ã¹»ÁË¡£
£¨×¢£º¸ÃÓï¾äÖ»ÄÜÓÃÓÚOracle£©
SELECT * from (SELECT temp.*, ROWNUM RN from (SELECT * from USERS ORDER BY ID DESC) temp) WHERE RN > 0 AND RN <= 10
SELECT *
from (SELECT AA.*, ROWNUM RN
from (SELECT * from USERS ORDER BY ID DESC) AA)
WHERE RN > 0 AND RN <= 10
˵Ã÷£º
ÆäÖÐUSERSΪÊý¾Ý¿â±íÃû
SELECT * from USERS ORDER BY ID DESC
ÕâÒ»¾äÊDz»½øÐзÖÒ³µÄ²éѯ¡£
¶øROWNUM <= 10ºÍRN >0ÓÃÓÚ¿ØÖÆÃ¿Ò³ÒªÏÔʾµÄÊý¾ÝÌõÊý£¬ÎÒÕâÀïÓÃROWNUM <= 10ºÍRN >0±íʾÿҳÏÔʾ10ÌõÊý¾Ý£¬ÄÇôҪ½øÈëÏÂÒ»Ò³£¬ÔòROWNUM <= 20ºÍRN >10
ÉÏÃæµÄÕâÁ½¸öÊýÖµÖ»ÐèÒªÄãÔÚ³ÌÐòÖж¯Ì¬´«ÈëÖµ£¬ÀýÈçÔÚstruts»òservletÖж¯Ì¬´«ÈëÁ½¸ö²ÎÊý¾Í¿ÉÒÔ½øÐзÖÒ³¿ØÖÆ¡£
MSSQL SYBASEÏÂÃæÓÃtop À´·ÖÒ³
POSTGRESQL MYSQL¾ÍÖ±½ÓÓÃlimit¸ü¼òµ¥ÁË
ÔÚoracle ÏÂÃæÓÐ4ÖÖ·½·¨
oracle·ÖÒ³¼¼Êõ2007Äê08ÔÂ13ÈÕ ÐÇÆÚÒ» 23:08Á½ÖÖ·ÖÒ³¼¼Êõ£¬µÚ¶þÖÖЧÂʸ߶àÁË
1. select * from
(select rownum rn,t.* from table t )
where rn <50 and rn>=1
2. select * from
(select rownum rn,t.* from table t rownum<50)
where rn>=1
´øÅÅÐòÒªÇóµÄ·ÖÒ³£¬ÔÚ9iÒÔÉϵĻ·¾³ÍƼöʹÓ÷ÖÎöº¯Êý
select * from
(select row_number() over(order by esn) rn,esn,akey from as_esn_info )
where rn <50 and rn>=1
£¨ÒÔÉÏ·½·¨ÑéÖ¤¹ý£©
»òÕßÒÔÏÂ
£¨1£©minus²î·ÖÒ³ £ºselect * from table where rownum<=10 minus select * from table where rownum<=5
£¨2£©rownumαÁзÖÒ³ £ºselect * from (select rownum tid,t.* from table t where rownum<=10) where tid>5
£¨3£©notinÏà·´·ÖÒ³£ºselect * from table where id not in(select id from table where rownum<=5) and rownum<=5
Ïà¹ØÎĵµ£º
ÔÚÒ»¸ö±íÖУ¬ÆäÖм¸¸ö×ֶεÄÖµÊÇÒ»ÑùµÄ£¬°´ÕÕÕ⼸¸ö×ֶνøÐзÖ×é²¢ºÏ²¢Êý¾Ý¡£
±íA id name role
1 ÕÅÈý &nb ......
<!--
/* Font Definitions */
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;
mso-font-charset:2;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:0 268435456 0 0 -2147483648 0;}
@font-face
{font-family:ËÎÌå;
panose-1:2 1 6 0 3 1 1 1 ......
Ò»¡¢Ë÷ÒýÀàÐͼ°½á¹¹£º
oracleµÄË÷Òý·ÖΪ5ÖÖ:ΨһË÷Òý£¬×éºÏË÷Òý£¬·´Ïò¼üË÷Òý£¬Î»Í¼Ë÷Òý£¬»ùÓÚº¯ÊýµÄË÷Òý
Âß¼ÉÏ£º
Single column µ¥ÁÐË÷Òý
Concatenated ¶àÁÐË÷Òý
Unique ΨһË÷Òý
NonUnique ·ÇΨһË÷Òý
Function-basedº¯ÊýË÷Òý
Domain ÓòË÷Òý
ÎïÀíÉÏ£º
Partitioned ·ÖÇøË÷Òý
NonPartitioned ......
Linux ƽ̨ÏÂOracle Silent Installations(¾²Ä¬°²×°)£¬Ò»Ö±¶¼Ã»Óг¢ÊÔ¹ýÓÃÕâÖÖ·½·¨À´×°Êý¾Ý¿â¡£ ÒòΪÓи߼¶µÄ¹¤¾ß£¬¾ÍûÓбØÒªÔÚÀ´ÓÃÕâÖÖ·½·¨ÁË£¬Oracle µÄ½çÃæ»¹ÊDZȽϷ½±ã£¬¶øÇÒÎÒÃÇ»¹ÓÐXmanager ¹¤¾ß£¬ËùÒÔÔÚlinux ÏÂ×°Èí¼þ£¬»¹ÊǺܷ½±ãµÄ¡£
Òò´ËÒ²¾ÍûÓÐÌ«ÔÚÒâÕ ......
Ò»¡¢ÉèÖóõʼ»¯²ÎÊý job_queue_processes
¡¡¡¡sql> alter system set job_queue_processes=n;£¨n>0£©
¡¡¡¡job_queue_processes×î´óֵΪ1000
¡¡¡¡
¡¡¡¡²é¿´job queue ºǫ́½ø³Ì
¡¡¡¡sql>select name,description from v$bgprocess;
¡¡¡¡
¡¡¡¡¶þ£¬dbms_job package Ó÷¨½éÉÜ
¡¡¡¡°üº¬ÒÔÏÂ×Ó¹ý³Ì£º
¡¡¡¡
¡¡ ......