ÈçºÎÈÃÄãµÄSQLÔËÐеøü¿ì
ÈçºÎÈÃÄãµÄSQLÔËÐеøü¿ì
---- ÈËÃÇÔÚʹÓÃSQLʱÍùÍù»áÏÝÈëÒ»¸öÎóÇø£¬¼´Ì«¹Ø×¢ÓÚËùµÃµÄ½á¹ûÊÇ·ñÕýÈ·£¬¶øºöÂÔ
Á˲»Í¬µÄʵÏÖ·½·¨Ö®¼ä¿ÉÄÜ´æÔÚµÄÐÔÄܲîÒ죬ÕâÖÖÐÔÄܲîÒìÔÚ´óÐ͵ĻòÊǸ´ÔÓµÄÊý¾Ý¿â
»·¾³ÖУ¨ÈçÁª»úÊÂÎñ´¦ÀíOLTP»ò¾ö²ßÖ§³ÖϵͳDSS£©ÖбíÏÖµÃÓÈΪÃ÷ÏÔ¡£±ÊÕßÔÚ¹¤×÷ʵ¼ù
Öз¢ÏÖ£¬²»Á¼µÄSQLÍùÍùÀ´×ÔÓÚ²»Ç¡µ±µÄË÷ÒýÉè¼Æ¡¢²»³ä·ÝµÄÁ¬½ÓÌõ¼þºÍ²»¿ÉÓÅ»¯µÄwhe
re×Ӿ䡣ÔÚ¶ÔËüÃǽøÐÐÊʵ±µÄÓÅ»¯ºó£¬ÆäÔËÐÐËÙ¶ÈÓÐÁËÃ÷ÏÔµØÌá¸ß£¡ÏÂÃæÎÒ½«´ÓÕâÈý¸ö
·½Ãæ·Ö±ð½øÐÐ×ܽ᣺
---- ΪÁ˸üÖ±¹ÛµØ˵Ã÷ÎÊÌ⣬ËùÓÐʵÀýÖеÄSQLÔËÐÐʱ¼ä¾ù¾¹ý²âÊÔ£¬²»³¬¹ý£±ÃëµÄ¾ù
±íʾΪ£¨< 1Ã룩¡£
---- ²âÊÔ»·¾³--
---- Ö÷»ú£ºHP LH II
---- Ö÷Ƶ£º330MHZ
---- Äڴ棺128Õ×
---- ²Ù×÷ϵͳ£ºOperserver5.0.4
----Êý¾Ý¿â£ºSybase11.0.3
Ò»¡¢²»ºÏÀíµÄË÷ÒýÉè¼Æ
----Àý£º±írecordÓÐ620000ÐУ¬ÊÔ¿´ÔÚ²»Í¬µÄË÷ÒýÏ£¬ÏÂÃ漸¸ö SQLµÄÔËÐÐÇé¿ö£º
---- 1.ÔÚdateÉϽ¨ÓÐÒ»·Ç¸öȺ¼¯Ë÷Òý
select count(*) from record where date >
'19991201' and date < '19991214'and amount >
2000 (25Ãë)
select &n
Ïà¹ØÎĵµ£º
YearCode:=yearof(Date);
MonthCode:=monthof(Date);
if MonthCode>9 then
FTime1:=inttostr(YearCode)+inttostr(MonthCode)
else
&nb ......
Kagula
2009-11-17
¹Ø¼ü´Ê
Java My SQL
¸ÅÒª£º
¶ÔMy SQL²Ù×÷·â×°µÄJavaÔ´ÂëʾÀý¡£
ÒªÇó»·¾³£º
J2SE1.5 + Eclipse3.4.2
ÕýÎÄ£º
Ïȵ½ÍøÉÏÏÂÔØmysql-connector-java-5.0.8-bin.jar£¬²¢°ÑËü·Åµ½ÄãµÄJava ProjectµÄUser Lib ......
SQLÖظ´¼Ç¼²éѯ
1¡¢²éÕÒ±íÖжàÓàµÄÖظ´¼Ç¼£¬Öظ´¼Ç¼ÊǸù¾Ýµ¥¸ö×ֶΣ¨peopleId£©À´ÅжÏ
select * from
people
where peopleId in (select peopleId from people group by peopleId
having count
(peopleId) > 1)
2¡¢É¾³ý±íÖжàÓàµÄÖظ´¼Ç¼£¬Öظ´¼Ç¼ÊǸù¾Ýµ¥¸ö×ֶΣ¨p ......
ÔÚSQLÖÐSelectÓï¾äµÄÖ´ÐÐ˳ÐòÈçÏ£º
(1)from×Ӿ䣬×é×°À´×Ô²»Í¬Êý¾ÝÔ´µÄÊý¾Ý
(2)WHERE×Ӿ䣬¸øÓèÖ¸¶¨Ìõ¼þ¶Ô¼Ç¼½øÐÐɸѡ
(3)GROUP BY×Ӿ䣬½«Êý¾Ý»®·ÖΪ¶à¸ö×é
(4)ʹÓþۼ¯º¯Êý½øÐмÆËã
(5)ʹÓÃHAVING×Ó¾äɸѡ·Ö×é
(6)¼ÆËãËùÓбí´ïʽ
(7)ʹÓÃORDER BY¶Ô½á¹û½øÐÐÅÅÐò ......
½ñÌìÔÚÐÞ¸ÄÒÔÇ°¿ª·¢µÄÒ»¸öÍøÕ¾µÄʱºòÓöµ½Ò»¸öÎÊÌ⣬ÒòΪ¹¦ÄܵÄÐèÒª£¬ÒÔÇ°µÄÒ»¸öÊý×ÖÀàÐÍ×ֶθıäΪÎı¾×ֶΣ¬ÒòΪÕâ¸ö×Ö¶ÎÐèÒª°üº¬¶à¸öÀà±ðµÄID£¬ÒÔÇ°Õâ¸ö×Ö¶ÎÖ»¶ÔÓ¦Ò»¸öIDµÄ¡£
ÍøÕ¾ÊÇASP VBÓïÑԵģ¬Êý¾Ý¿âʹÓõÄÊÇAccess
ÐÞ¸ÄÊý¾ÝÀàÐÍÖ®ºóǰ̨µÄ²éѯ´úÂë¾Í²»ÄÜʹÓÃÖîÈçxID=1ÕâÖÖÌõ¼þÁË¡£ÓÉÓÚÏÖÔÚ¸Ã×ֶαäΪÎı¾ÀàÐ ......