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

SQLÓï¾äÔõôд£¿

ÎÒÓÐÒ»Õűí Create table abc (ID int primary key, A varchar(20), B varchar(20)); Êý¾Ý¿âÖÐAºÍB×ֶβ»ÄÜÖظ´£¬Ò²¾ÍÊDZÈÈçÎÒ²åÈëÒ»Ìõ¼Ç¼ £ºinsert into abc(ID, A, B) values(1, abc123, abc456);
ÎÒÔÚ²åÈëµÚ¶þÌõ¼Ç¼µÄʱºò£¬¾Í²»ÄܲåÈë X>=abc123,»òÕßX <=abc456µÄÊý£¬Ò²¾ÍÊÇÖ´ÐÐÕâÑùÒ»ÌõдÈëÓï¾ä¾ÍÐèÒª±¨Ð´ÈëÖظ´µÄ´íÎó£ºinsert into abc(ID, A, B) values(1, abc124, abc455); Ò²¾ÍÊÇAºÍBÖ®¼äµÄÊý¶¼ËãÖظ´£¬Ò»Ìõ¼Ç¼¿ÉÒÔдÕâÑùÒ»ÌõsqlÓï¾ä½øÐÐÅжϣºselect * from abc where A>=abc123 and A <=abc456 and B>=abc123 abd B <=abc456 ²»ÄÜдÈ룬µ«ÊÇÊý¾Ý¿âÖÐÓÐ10ÍòÌõ¼Ç¼£¬ÕâÑù½øÐÐÖظ´ÅжϾÍÏԵúÜÂýÁË£¬Çë´ó¼Ò°ïæÏëÒ»¸ö±È½Ï¿ìËÙµÄÅжÏдÈëÊÇ·ñÖظ´µÄsqlÓï¾ä£¬Ð»Ð»£¡
abc122 abc467ËãÖظ´Âð

²»Ëã.

ÕâÑù¡£¡£¡£ÄDz»ÊDzåÈ뷶ΧֻÄÜÔ½À´Ô½Ð¡£¿

abc122 abc455ËãÖظ´Âð

ÒýÓÃ
ÕâÑù¡£¡£¡£ÄDz»ÊDzåÈ뷶ΧֻÄÜÔ½À´Ô½Ð¡£¿

ÕâÑùËãÖظ´

¾ÍÊÇÖ»Äܲå´óµÄ£¬²»ÄܲåСµÄ£¿ÊÇ°É£¿

ÒýÓÃ
abc122 abc455ËãÖظ´Âð

ÕâÑùÒ²ËãÖظ´.

»¹ÊǵÃÇëСPÁº.

ÄǾÍÊDzåÈëµÄʱºòAҪСÓÚÊý¾Ý¿âÖÐ×îСµÄA£¬BÒª´óÓÚÊý¾Ý¿âÖÐ×î´óµÄB£¿£¿

AºÍBÖ®¼äµÄÊýÊÇÁ¬ÐøµÄ,BÊÇÔÚAµÄ»ù´¡ÉϵÃÀ´µÄ.

ÒýÓÃ
ÄǾÍÊDzåÈëµÄʱºòAҪСÓÚÊý¾Ý¿âÖÐ×îСµÄA£¬BÒª´óÓÚÊý¾Ý¿âÖÐ×î´óµÄB£¿£¿

²»ÊÇ,ÒòΪдÈëµÚ¶þÌõ¼Ç¼²»Ò»¶¨Òª´ÓÊý¾Ý¿âÖÐ×î´óµÄ¿ªÊ¼Á¬Ðø.

û¿´¶®£¬¶àÁм¸ÌõÊý¾Ý

SQL code



Code highlighting produced by Actip


Ïà¹ØÎÊ´ð£º

ÇóSQL£¿

´ó¼ÒºÃ£¬ÇëÎÊÔÚ±íMÖÐÓÐ×ֶΣºa b c d e 
ÎÒÏë²é³öÆäÖÐÂú×ãÏÂÃæÈÎÒâÒ»ÏîµÄÊý¾Ý£¬1.×Ö¶Îa µÄÖµ²»ÊÇ ¡®Êé»ò±Ê»ò±¾¡¯ÖÐÈÎÒ»£¬2.aΪÊéµÄʱºò×Ö¶Îb,cÊÇ¿Õ;3.µ±aֵΪ±ÊµÄʱºòdÊÇ¿Õ;4.µ±aΪ±¾µÄʱºòb,d,e¶¼ÊÇ¿Õ;5.È ......

pl/sqlµ¼ÈëÊý¾ÝÎÊÌâ

ÎÒEXCELÖÐÒ»¸öµ¥Ôª¸ñµÄÊý¾ÝÈç  "2009-01","8949-232"

½«Õâ¸öÊý¾ÝÕ³Ìùµ½PL/SQLÖеÄÒ»¸ö±íÖкó,Êý¾ÝÈ·ÊdzÉΪÁË 2009-01,8949-232 ,°ÑËùÓеÄ""¶¼Ã»ÁË,
ÈçºÎŪÄØ?Çë´ó¼ÒÊÔ ......

sql²éѯÒÉÎÊ

±íÖа´datadate,tradeidΪÖ÷¼ü£¬Ò²¾ÍÊÇ˵tradeid»áÖظ´³öÏÖÔÚ²»Í¬ÌìÖУ¬Í¬Ò»ÌìµÄtradeidÊDz»Í¬µÄ¡£ÏÖÔÚÎÒÏ£ÍûÈ¡Ò»¶Îʱ¼ä·¶Î§ÄÚ²»Öظ´µÄtradeid£¬ÇÒֻҪÿ¸ötradeidµÄ×îºóÒ»´Î³öÏÖµÄÄÇÌõ¡£sqlÓï¾ä¸ÃÔõôд

£º ......

ÀÏÎÊÌâ ͨ¹ýSQLÓï¾äÈçºÎɾ³ý±íÖеÄÖظ´¼Ç¼£¿

±ía(ûÓÐÖ÷¼ü)
id          name      age       
----------- ---------- -----------
1          chenqin& ......

Õâ¸ösqlÓï¾ä¸ÃÔõôд,¼±!!!!

¸ù¾Ý°à¼¶·Ö×飬ͳ¼Æƽ¾ù·ÖºÍ²»¼°¸ñµÄ¸öÊý.
ÎÒµÄÏë·¨ÊÇÕâÑùµÄ.
Select  avg(testScore) as ƽ¾ù·Ö, count(testScore <600) as ²»¼°¸ñÊý , from [Person] Group by Class
µ«ÊÇcount(testScore <60 ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ