Oracle¡¢SQL Server¡¢AccessÊý¾Ý¿â¸ßЧ¹û·ÖÒ³¼¼ÇÉ
ÔÚ³ÌÐòµÄ¿ª·¢¹ý³ÌÖУ¬´¦Àí·ÖÒ³ÊÇ´ó¼Ò½Ó´¥±È½ÏƵ·±µÄʼþ£¬ÒòΪÏÖÔÚÈí¼þ»ù±¾É϶¼ÊÇÓëÊý¾Ý¿â½øÐйҵöµÄ¡£µ«Ð§ÂÊÓÖÊÇÎÒÃÇËù×·ÇóµÄ£¬Èç¹ûÊÇÏñÔÀ´ÄÇÑù°ÑËùÓÐÂú×ãÌõ¼þµÄ¼Ç¼ȫ²¿¶¼Ñ¡Ôñ³öÀ´£¬ÔÙÈ¥½øÐзÖÒ³´¦Àí£¬ÄÇô¾Í»á¶à¶àµÄÀ˷ѵôÐí¶àµÄϵͳ´¦Àíʱ¼ä¡£ÎªÁËÄܹ»°ÑЧÂÊÌá¸ß£¬ËùÒÔÏÖÔÚÎÒÃǾÍֻѡÔñÎÒÃÇÐèÒªµÄÊý¾Ý£¬¼õÉÙÊý¾Ý¿âµÄ´¦Àíʱ¼ä£¬ÒÔϾÍÊdz£ÓÃSQL·ÖÒ³´¦Àí£º
¡¡¡¡1¡¢SQL Server¡¢AccessÊý¾Ý¿â
¡¡¡¡Õⶼ΢ÈíµÄÊý¾Ý¿â£¬¶¼ÊÇÒ»¼ÒÈË£¬»ù±¾µÄ²Ù×÷¶¼ÊDz¶à£¬³£²ÉÓÃÈçÏ·ÖÒ³Óï¾ä£º
¡¡¡¡PAGESIZE£ºÃ¿Ò³ÏÔʾµÄ¼Ç¼Êý
¡¡¡¡CURRENTPAGE£ºµ±Ç°Ò³ºÅ
¡¡¡¡Êý¾Ý±íµÄÃû×ÖÊÇ£ºcomponents
¡¡¡¡Ë÷ÒýÖ÷¼ü×ÖÊÇ£ºid
ÒÔÏÂÊÇÒýÓÃÆ¬¶Î£º
¡¡¡¡select top PAGESIZE * from components where id not in
¡¡¡¡(select top (PAGESIZE*(CURRENTPAGE-1))
¡¡¡¡id from components order by id)order by id
¡¡¡¡ÈçÏÂÁУº
ÒÔÏÂÊÇÒýÓÃÆ¬¶Î£º
¡¡¡¡select top 10 * from components where id not in
¡¡¡¡(select top 10*10 id from components order by id)
¡¡¡¡order by id
¡¡¡¡´Ó101Ìõ¼Ç¼¿ªÊ¼Ñ¡Ôñ£¬Ö»Ñ¡ÔñÇ°ÃæµÄ10Ìõ¼Ç¼
¡¡¡¡2¡¢OracleÊý¾Ý¿â
¡¡¡¡ÒòΪOracleÊý¾Ý¿âûÓÐTop¹Ø¼ü×Ö£¬ËùÒÔÕâÀï¾Í²»Äܹ»Ïñ΢ÈíµÄÊý¾Ý¾ÝÄÇÑù²Ù×÷£¬ÕâÀïÓÐÁ½ÖÖ·½·¨£º
¡¡¡¡(1)¡¢Ò»ÖÖÊÇÀûÓÃÏà·´µÄ¡£
¡¡¡¡PAGESIZE£ºÃ¿Ò³ÏÔʾµÄ¼Ç¼Êý
¡¡¡¡CURRENTPAGE£ºµ±Ç°Ò³ºÅ
¡¡¡¡Êý¾Ý±íµÄÃû×ÖÊÇ£ºcomponents
¡¡¡¡Ë÷ÒýÖ÷¼ü×ÖÊÇ£ºid
ÒÔÏÂÊÇÒýÓÃÆ¬¶Î£º
¡¡¡¡select * from components where id not
¡¡¡¡in(select id from components where
¡¡¡¡rownum<=(PAGESIZE*(CURRENTPAGE-1)))
¡¡¡¡and rownum<=PAGESIZE order by id;
¡¡¡¡ÈçÏÂÀý£º
ÒÔÏÂÊÇÒýÓÃÆ¬¶Î£º
¡¡¡¡select * from components where id not in
¡¡¡¡(select id from components where rownum<=100)
¡¡¡¡and rownum<=10 order by id;
¡¡¡¡´Ó101µ½¼Ç¼¿ªÊ¼Ñ¡Ôñ£¬Ñ¡ÔñÇ°Ãæ10Ìõ¡£
¡¡¡¡(2)¡¢Ê¹ÓÃminus£¬¼´ÖÐÎĵÄÒâ˼¾ÍÊǼõÈ¥¡£
ÒÔÏÂÊÇÒýÓÃÆ¬¶Î£º
¡¡¡¡
Ïà¹ØÎĵµ£º
ÔÚ°²×°oracleµÄDBCA¹ý³ÌÖУ¬ÔÚ´´½¨²¢Æô¶¯oracleʵÀý£¨´´½¨¿Ë¡Êý¾Ý¿â£¬½ø¶ÈÌõÔÚ45%£©¾Í½øÐв»ÏÂÈ¥ÁË£¬ÖØ×°Á˼¸´ÎÖÕÓÚÕÒµ½ÎÊÌâµÄÖ¢½áÁË£¬½â¾ö¹ý³ÌÈçÏ£º
1¡¢×°Á˼¸±é¾ÍÊÇÄǸöÎÊÌ⣬ÎÒͻȻÏëµ½Òª¿´¿´°²×°ÈÕÖ¾¡£
2¡¢ÊÇÔÚ´´½ ......
--1¼ÓÄÚ´æ±í
EXEC sp_tableoption '±íÃû','pintable', 'true'
--2Ð¶ÔØÄÚ´æ±í
EXEC sp_tableoption '±íÃû','pintable', 'false'
--2²éѯÊÇ·ñÓÐÄÚ´æ±íפÁô
SELECT * from INFORMATION_SCHEMA.Tables
WHERE TABLE_TYPE = 'BASE TABLE'
AND OBJECTPROP ......
Subquery: (single-row subqueries and multi-rows subqueries).
select select_list
from table
where expr operator (select select_list from table);
single-row subqueries operator: =, >, >=, <, <=, <>
e.g.:
1. select department_id, min(salary) from employees group by department_id ......
Differring Constraints:
Constraints can have the following attributes: DEFFERRABLE / NOT DEFFERRABLE, INITIALLY DEFFERRED / INITIALLY IMMEDIATE.
e.g.:
alter table dept2 add constraint dept2_id_pk primary key (department_id) deferrable initially deferred; // deferring constraint on creation. ......
oracle tips
ExistµÄÓ÷¨£º
select gw.ndocid from
(select ndocid from wf_doc_gw_shouwen union select ndocid from wf_doc_gw_fawen) gw
where
not exists (select null from wf_doc_gw_sn sn where sn.ndocid=gw.ndocid)
2¡£°ÑGW±íºÍSN±íÀïÏàͬµÄNDOCIDÏÔʾ³öÀ´
select gw.ndocid from
(se ......