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

sqlÓÅ»¯2

 ÉÏÃæÎÒÃÇÌáµ½µÄÊÇһЩ»ù±¾µÄÌá¸ß²éѯËٶȵÄ×¢ÒâÊÂÏî,µ«ÊÇÔÚ¸ü¶àµÄÇé¿öÏÂ,ÍùÍùÐèÒª·´¸´ÊÔÑé±È½Ï²»Í¬µÄÓï¾äÒԵõ½×î¼Ñ·½°¸¡£×îºÃµÄ·½·¨µ±È»ÊDzâÊÔ£¬¿´ÊµÏÖÏàͬ¹¦ÄܵÄSQLÓï¾äÄĸöÖ´ÐÐʱ¼ä×îÉÙ£¬µ«ÊÇÊý¾Ý¿âÖÐÈç¹ûÊý¾ÝÁ¿ºÜÉÙ£¬ÊDZȽϲ»³öÀ´µÄ£¬Õâʱ¿ÉÒÔÓò鿴ִÐмƻ®£¬¼´£º°ÑʵÏÖÏàͬ¹¦ÄܵĶàÌõSQLÓï¾ä¿¼µ½²éѯ·ÖÎöÆ÷£¬°´CTRL+L¿´²éËùÀûÓõÄË÷Òý£¬±íɨÃè´ÎÊý£¨ÕâÁ½¸ö¶ÔÐÔÄÜÓ°Ïì×î´ó£©£¬×ÜÌåÉÏ¿´Ñ¯³É±¾°Ù·Ö±È¼´¿É¡£
¼òµ¥µÄ´æ´¢¹ý³Ì¿ÉÒÔÓÃÏòµ¼×Ô¶¯Éú³É£ºÔÚÆóÒµ¹ÜÀíÆ÷¹¤¾ßÀ¸µã»÷ÔËÐÐÏòµ¼Í¼±ê£¬µã»÷”Êý¾Ý¿â”¡¢”´´½¨´æ´¢¹ý³ÌÏòµ¼”¡£¸´ÔÓ´æ´¢¹ý³ÌµÄµ÷ÊÔ£ºÔÚ²éѯ·ÖÎöÆ÷×ó±ßµÄ¶ÔÏóä¯ÀÀÆ÷£¨Ã»ÓУ¿°´F8£©Ñ¡ÔñÒªµ÷ÊԵĴ洢¹ý³Ì,µãÓÒ¼ü£¬µãµ÷ÊÔ£¬ÊäÈë²ÎÊýÖ´ÐУ¬³öÏÖÒ»¸ö¸¡¶¯¹¤¾ßÌõ£¬ÉÏÃæÓе¥²½Ö´ÐУ¬¶ÏµãÉèÖõȡ£
Ò»¡¢²»ºÏÀíµÄË÷ÒýÉè¼Æ
----Àý£º±írecordÓÐ620000ÐУ¬ÊÔ¿´ÔÚ²»Í¬µÄË÷ÒýÏ£¬ÏÂÃ漸¸ö SQLµÄÔËÐÐÇé¿ö£º
---- 1.ÔÚdateÉϽ¨ÓÐÒ»·Ç¸öȺ¼¯Ë÷Òý
select count(*) from record where date >
'19991201' and date < '19991214'and amount >
2000 (25Ãë)
select date,sum(amount) from record group by date
(55Ãë)
select count(*) from record where date >
'19990901' and place in ('BJ','SH') (27Ãë)
---- ·ÖÎö£º
----dateÉÏÓдóÁ¿µÄÖظ´Öµ£¬ÔÚ·ÇȺ¼¯Ë÷ÒýÏ£¬Êý¾ÝÔÚÎïÀíÉÏËæ»ú´æ·ÅÔÚÊý¾ÝÒ³ÉÏ£¬ÔÚ
·¶Î§²éÕÒʱ£¬±ØÐëÖ´ÐÐÒ»´Î±íɨÃè²ÅÄÜÕÒµ½ÕâÒ»·¶Î§ÄÚµÄÈ«²¿ÐС£
---- 2.ÔÚdateÉϵÄÒ»¸öȺ¼¯Ë÷Òý
select count(*) from record where date >
'19991201' and date < '19991214' and amount >
2000 £¨14Ã룩
select date,sum(amount) from record group by date
£¨28Ã룩
select count(*) from record where date >
'19990901' and place in ('BJ','SH')£¨14Ã룩
---- ·ÖÎö£º
---- ÔÚȺ¼¯Ë÷ÒýÏ£¬Êý¾ÝÔÚÎïÀíÉÏ°´Ë³ÐòÔÚÊý¾ÝÒ³ÉÏ£¬Öظ´ÖµÒ²ÅÅÁÐÔÚÒ»Æð£¬Òò¶øÔÚ·¶
Χ²éÕÒʱ£¬¿ÉÒÔÏÈÕÒµ½Õâ¸ö·¶Î§µÄÆðÄ©µã£¬ÇÒÖ»ÔÚÕâ¸ö·¶Î§ÄÚɨÃèÊý¾ÝÒ³£¬±ÜÃâÁË´ó·¶
ΧɨÃ裬Ìá¸ßÁ˲éѯËٶȡ£
---- 3.ÔÚplace£¬date£¬amountÉϵÄ×éºÏË÷Òý
select count(*) from record where date >
'19991201' and date < '19991214' and amount >
2000 £¨26Ã룩
select date,sum(amount) from record group by date
£¨27Ã룩
select count(*) from record where date &g


Ïà¹ØÎĵµ£º

PL/SQL¿ª·¢

bulk collectÊÇ¿ÉÒÔ¿´×öÊÇÒ»ÖÖÅú»ñÈ¡µÄ·½Ê½£¬ÔÚÎÒÃǵÄplsqlµÄ´úÂë¶ÎÀï¾­³£×÷ΪintoµÄÀ©Õ¹À´Ê¹Ó᣶ÔÓÚselect id into v from .... ÊÇÒ»¸ö³£ÓõÄÓ÷¨¡£²»¹ýÕâÀïÖ»ÄÜÊÇ·µ»Øµ¥Ìõ¼Ç¼µÄʱºò£¬²ÅÄÜʹÓã¬Èç¹ûÊÇÓжàÌõ¼Ç¼ÎÒÃǾͲ»ÄÜÓÃÕâÑùµÄ·½Ê½£¬¶øÊÇʹÓÃfetchºÍÑ­»·µÄ·½Ê½£¬²»½öʹÓÃÂé·³£¬¶øÇÒÐÔÄÜÒ²µ×Ï£¬ÕâʱÎÒÃǵÄbulk coll ......

SQL ServerÖеÄNullÖµ½âÎö

NULL
ÊÇÊý¾Ý¿âÖÐÌØÓеÄÊý¾ÝÀàÐÍ£¬µ±Ò»Ìõ¼Ç¼µÄij¸öÁÐΪ
NULL
£¬Ôò±íʾÕâ¸öÁеÄÖµÊÇδ֪µÄ¡¢ÊDz»È·¶¨µÄ¡£¼ÈÈ»ÊÇδ֪µÄ£¬¾ÍÓÐÎÞÊýÖֵĿÉÄÜÐÔ¡£Òò´Ë£¬
NULL
²¢²»ÊÇÒ»¸öÈ·¶¨µÄÖµ¡£
ÕâÊÇ
NULL
µÄÓÉÀ´¡¢Ò²ÊÇ
NULL
µÄ»ù´¡£¬ËùÓкÍ
NULL
Ïà¹ØµÄ²Ù×÷µÄ½á¹û¶¼¿ÉÒÔ´Ó
NULL
µÄ¸ÅÄîÍƵ¼³öÀ´¡£
ÅжÏÒ»¸ö×Ö¶ÎÊÇ·ñΪ
NULL
......

SQLÓÅ»¯

(Ò»)ÉîÈëdz³öÀí½âË÷Òý½á¹¹
¡¡¡¡Êµ¼ÊÉÏ£¬Äú¿ÉÒÔ°ÑË÷ÒýÀí½âΪһÖÖÌØÊâµÄĿ¼¡£Î¢ÈíµÄSQL SERVERÌṩÁËÁ½ÖÖË÷Òý£º¾Û¼¯Ë÷Òý(clustered index£¬Ò²³Æ¾ÛÀàË÷Òý¡¢´Ø¼¯Ë÷Òý)ºÍ·Ç¾Û¼¯Ë÷Òý(nonclustered index£¬Ò²³Æ·Ç¾ÛÀàË÷Òý¡¢·Ç´Ø¼¯Ë÷Òý)¡£ÏÂÃ棬ÎÒÃǾÙÀýÀ´ËµÃ÷һϾۼ¯Ë÷ÒýºÍ·Ç¾Û¼¯Ë÷ÒýµÄÇø±ð£º
¡¡¡¡Æäʵ£¬ÎÒÃǵĺºÓï×ÖµäµÄÕýÎı ......

SQL 2005 CLR º¯ÊýʵÏÖ¼ò·±×ª»»¹¦ÄÜ

   ΢ÈíµÄÒ»¸öMicrosoft Visual Studio International Pack v1.0£¬ÀïÃæ¾ÍÓÐÖÐÎÄ×Ö´¦Àí¹¦ÄÜ£¬»¹±È½Ï·á¸»£¬ÕâÀïÖ»Óüò·±×ª»»¡£Microsoft Visual Studio International Pack v1.0µÄÏÂÔصØÖ·£ºhttp://download.microsoft.com/download/5/7/3/57345088-ACF8-4E9B-A9A7-EBA35452DEF2/vsintlpack1.zip¡£½âѹ֮ºó°²×°CHTC ......

ORACLE PL/SQL ¼¯ºÏѧϰ±Ê¼Ç(¶þ)

Èý¡¢Ç¶Ì×±íµÄʹÓ÷½·¨
 
1¡¢½«Ç¶Ì×±í¶¨ÒåΪPL/SQLµÄ³ÌÐò¹¹Ôì¿é
 
TYPE type_name IS TABLE OF element_type[NOT NULL];
 
ÈçÏÂÀýËùʾ£º
DECLARE

-- Define a nested table of variable length strings.
TYPE card_table IS TABLE OF VARCHAR2(5 CHAR);

-- Declare and initialize a n ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ