Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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


Ïà¹ØÎĵµ£º

SQLÓÅ»¯

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

SQL UpdateÓï¾äµÄÖ´ÐÐ˳Ðò

Ö´ÐÐ˳Ðò:´Ó×óµ½ÓÒ,±äÁ¿ÓÅÏÈ,ÖðÐиüÐÂ
 Õª×ÔCSDNµÄÀý×Ó(http://topic.csdn.net/u/20091030/16/7fd75fa6-bdb9-4516-9b27-48aef69703ba.html
http://topic.csdn.net/u/20090904/16/e5dad9c7-fb59-41b9-b28d-e3b71c3e8420.html)
1.±äÁ¿ÓÅÏÈ
create table #t (field1 varchar(10),field2 varchar(10))
insert #t sel ......

ORACLE PL/SQL ¼Ç¼(Record)ѧϰ±Ê¼Ç(¶þ)

¶þ¡¢ÒÔÐβεÄÐÎʽ¶¨ÒåºÍʹÓüǼ¡¢¶ÔÏóÀàÐÍ
ÔÚÓÃ×÷ÐÎʽ²ÎÊýʱ£¬¼Ç¼ÀàÐͺͶÔÏóÀàÐÍÓкܶàÏà֮ͬ´¦¡£ÔÚ½«ËüÃÇ×÷ΪÓαꡢº¯Êý»ò¹ý³ÌµÄÐÎʽ²ÎÊýÒÔÇ°£¬ÊÂÏȶ¼±ØÐ붨ÒåÒ»¸ö¼Ç¼ÀàÐÍ»òÕ߶ÔÏóÀàÐÍ¡£
ÈçÏÂÀýËùʾ£º
 
¼Ç¼
DECLARE

-- Define a record type.
TYPE individual_record IS RECORD
(individual_id ......

ORACLE PL/SQL ¼¯ºÏAPI ×ܽá

ORACLE 10GµÄ¼¯ºÏAPI
 
¼¯ºÏAPI·½·¨×îÔçÊÇÔÚORACLE 8IÖÐÒýÈëµÄ¡£¼¯ºÏAPIÌṩÁ˼ò»¯·ÃÎʼ¯ºÏµÄ·½·¨¡£ÔÚORACLE 10GÒÔÇ°£¬ÕâЩ·½·¨È·Êµ¼ò»¯Á˶Լ¯ºÏµÄ·ÃÎÊ¡£µ«ÊÇ£¬²¢²»ÊÇ·ÇÒªÇóÕÆÎÕÕâЩ·½·¨²»¿É¡£´ÓORACLE 9IµÄINDEX-BY±íµ½ORACLE 10GµÄÁªºÏÊý×éµÄת»»£¬Ê¹ËüÃdzÉΪ±ØÐëÕÆÎյķ½·¨¡£
 
ÏÂÃæÊÇÎÒ´ÓÊéÉÏժ¼ÏµÄһР......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ