Oracle, DB2 ¼° MySQL ·ÖÒ³²éѯд·¨
ÏÖÔÚÔÚWEB Ó¦ÓÃÖÐʹÓ÷ÖÒ³¼¼ÊõÔ½À´Ô½ÆÕ±éÁË£¬ÆäÖÐÀûÓÃÊý¾Ý¿â²éѯ·ÖÒ³ÊÇÒ»ÖÖЧÂʱȽϸߵķ½·¨£¬
ÏÂÃæÁгöÁËOracle, DB2 ¼° MySQL ·ÖÒ³²éѯд·¨¡£
Ò»£ºOracle
select * from (select rownum,name from table where rownum <=endIndex )
where rownum > startIndex
¶þ£ºDB2
DB2·ÖÒ³²éѯ
SELECT * from (Select ×Ö¶Î1,×Ö¶Î2,×Ö¶Î3,rownumber() over(ORDER BY ÅÅÐòÓõÄÁÐÃû ASC) AS rn from ±íÃû) AS a1 WHERE a1.rn BETWEEN 10 AND 20
ÒÔÉϱíʾÌáÈ¡µÚ10µ½20µÄ¼Í¼
select * from (select rownumber() over(order by id asc ) as rowid from table where rowid <=endIndex ) AS a1
where a1.rowid > startIndex
Èý£ºMySQL
select * from table limit start,pageNum
SELECT EVENTID , EVENTNAME , CREATETIME , ELAPSEDTIME , REPEATCOUNT , MESSAGE , LOCALINSTANCEID , STATUS , MEMO from(SELECT rownumber() OVER (ORDER BY CREATETIME ASC) AS rowid from MS_EVENT WHERE rowid <=20) as a1 WHERE a1.rowid >10
SELECT * from (SELECT EVENTID , EVENTNAME , CREATETIME , ELAPSEDTIME , REPEATCOUNT , MESSAGE , LOCALINSTANCEID , STATUS , MEMO,
ROWNUMBER() OVER (ORDER BY CREATETIME ASC) AS rn from MS_EVENT) AS a1 WHERE a1.rn BETWEEN 10 and 20
--------------------------------------------------------------------
1. ±ê×¼µÄrownum·ÖÒ³²éѯʹÓ÷½·¨£º
select *
from (select c.*, rownum rn from content c)
where rn >= 1
and rn <= 5
2. µ«ÊÇÈç¹û, ¼ÓÉÏorder by addtime ÅÅÐòÔòÊý¾ÝÏÔʾ²»ÕýÈ·
select *
from (select c.*, rownum rn from content c order by addtime)
where rn >= 1
and rn <= 5
½â¾ö·½·¨£¬ÔÙ¼ÓÒ»²ã²éѯ£¬Ôò¿ÉÒÔ½â¾ö£¬
select *
from (s
Ïà¹ØÎĵµ£º
1. ÔÚ´ò¿ªEnterprise Manager Consolʱ±¨´í: "ÕÒ²»µ½Ä¿±êÖ÷»ú";
¡¾½â¾ö·½°¸¡¿¸ÃÎÊÌâÔÚʹÓÃGhostÖÆ×÷µÄϵͳÖг£¼û, ³ö´íÔÒòÊÇOracleÖÐÅäÖõÄÖ÷»úÃû
ºÍʵ¼ÊµÄÖ÷»úÃû²»Ò»ÖÂ. ½â¾ö·½·¨ÈçÏÂ:
(1) Enterprise Manager Consol -> ¹¤¾ß²Ëµ¥ ->·þÎñ¹ÜÀí -> Oracle Net Manager;
(2) ½«"±¾µØ ......
¹ý³ÌÖеÄÊÂÎñ
¶¨Òå¹ý³Ìp1
create or replace procedure p1
as
begin
insert into student values(5,'xdh','m',sysdate);
rollback;
end;
¶¨Òå¹ý³Ìp2
create or replace procedure p2
as
begin
update student set stu_sex = 'a' where stu_id = 3;
p1;
end;
Ö´Ðйý³Ìp2
exec p2;
Ö´ÐÐÍê±Ï·¢ÏÖ ......
Oracle RAC
¡¡¡¡RAC£¬È«³Æreal application clusters£¬ÒëΪ“ÕæÕýÓ¦Óü¯Èº”£¬ ÊÇOracleаæÊý¾Ý¿âÖвÉÓõÄÒ»Ïîм¼Êõ£¬Ò²ÊÇOracleÊý¾Ý¿âÖ§³ÖÍø¸ñ¼ÆËã»·¾³µÄºËÐļ¼Êõ¡£
¡¡¡¡Oracle RACÖ÷ÒªÖ§³ÖOracle9i¡¢10g¡¢11g°æ±¾£¬¿ÉÒÔ¿ÉÒÔÖ§³Ö24 x 7 ÓÐЧµÄÊý¾Ý¿âÓ¦Óà ϵͳ£¬Ôڵͳɱ¾·þÎñÆ÷ÉϹ¹½¨¸ß¿ÉÓÃÐÔÊý¾Ý¿âϵͳ£¬²¢Ç ......
ʵÀýÒ»£ºÎ޲εĴ洢¹ý³Ì
$conn = mysql_connect('localhost','root','root') or die ("Êý¾ÝÁ¬½Ó´íÎó!!!");
mysql_select_db('test',$conn);
$sql = "
create procedure myproce()
begin
INSERT INTO user (id, username, sex) VALUES (NULL, 's', '0');
end;
";
mysql_query($sql);//´´½¨Ò»¸ömyproceµÄ´æ´¢¹ý³Ì
......
ËùÓеÄÊýѧº¯ÊýÔÚÒ»¸ö³ö´íµÄÇé¿öÏ·µ»ØNULL¡£
-
µ¥Ä¿¼õ¡£¸Ä±ä²ÎÊýµÄ·ûºÅ¡£
mysql> select - 2;
×¢Ò⣬Èç¹ûÕâ¸ö²Ù×÷·ûÓëÒ»¸öBIGINTʹÓ㬷µ»ØÖµÊÇÒ»¸öBIGINT£¡ÕâÒâζ×ÅÄãÓ¦¸Ã±ÜÃâÔÚÕûÊýÉÏʹÓÃ-£¬ÄÇ¿ÉÄÜÓÐÖµ-2^63£¡
ABS(X)
·µ»ØXµÄ¾ø¶ÔÖµ¡£
mysql ......