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

sqlÖÐdatediffºÍdateaddµÄÓ÷¨

ͨ³££¬ÄãÐèÒª»ñµÃµ±Ç°ÈÕÆںͼÆËãһЩÆäËûµÄÈÕÆÚ£¬ÀýÈ磬ÄãµÄ³ÌÐò¿ÉÄÜÐèÒªÅжÏÒ»¸öÔµĵÚÒ»Ìì»òÕß×îºóÒ»Ìì¡£ÄãÃǴ󲿷ÖÈË´ó¸Å¶¼ÖªµÀÔõÑù°ÑÈÕÆÚ½øÐзָÄê¡¢Ô¡¢Èյȣ©£¬È»ºó½ö½öÓ÷ָî³öÀ´µÄÄê¡¢Ô¡¢ÈյȷÅÔÚ¼¸¸öº¯ÊýÖмÆËã³ö×Ô¼ºËùÐèÒªµÄÈÕÆÚ£¡
¡¡¡¡ÔÚÕâƪÎÄÕÂÀÎÒ½«¸æËßÄãÈçºÎʹÓÃDATEADDºÍDATEDIFFº¯ÊýÀ´¼ÆËã³öÔÚÄãµÄ³ÌÐòÖпÉÄÜÄãÒªÓõ½µÄһЩ²»Í¬ÈÕÆÚ¡£
                                        
¡¡¡¡ÔÚʹÓñ¾ÎÄÖеÄÀý×Ó֮ǰ£¬Äã±ØÐë×¢ÒâÒÔϵÄÎÊÌâ¡£´ó²¿·Ö¿ÉÄܲ»ÊÇËùÓÐÀý×ÓÔÚ²»Í¬µÄ»úÆ÷ÉÏÖ´ÐеĽá¹û¿ÉÄܲ»Ò»Ñù£¬ÕâÍêÈ«ÓÉÄÄÒ»ÌìÊÇÒ»¸öÐÇÆڵĵÚÒ»ÌìÕâ¸öÉèÖþö¶¨¡£µÚÒ»Ì죨DATEFIRST£©É趨¾ö¶¨ÁËÄãµÄϵͳʹÓÃÄÄÒ»Ìì×÷ΪһÖܵĵÚÒ»Ìì¡£ËùÓÐÒÔϵÄÀý×Ó¶¼ÊÇÒÔÐÇÆÚÌì×÷ΪһÖܵĵÚÒ»ÌìÀ´½¨Á¢£¬Ò²¾ÍÊǵÚÒ»ÌìÉèÖÃΪ7¡£¼ÙÈçÄãµÄµÚÒ»ÌìÉèÖò»Ò»Ñù£¬Äã¿ÉÄÜÐèÒªµ÷ÕûÕâЩÀý×Ó£¬Ê¹ËüºÍ²»Í¬µÄµÚÒ»ÌìÉèÖÃÏà·ûºÏ¡£Äã¿ÉÒÔͨ¹ý@@DATEFIRSTº¯ÊýÀ´¼ì²éµÚÒ»ÌìÉèÖá£
                                                               
¡¡¡¡ÎªÁËÀí½âÕâЩÀý×Ó£¬ÎÒÃÇÏȸ´Ï°Ò»ÏÂDATEDIFFºÍDATEADDº¯Êý¡£DATEDIFFº¯Êý¼ÆËãÁ½¸öÈÕÆÚÖ®¼äµÄСʱ¡¢Ìì¡¢ÖÜ¡¢Ô¡¢ÄêµÈʱ¼ä¼ä¸ô×ÜÊý¡£DATEADDº¯Êý¼ÆËãÒ»¸öÈÕÆÚͨ¹ý¸øʱ¼ä¼ä¸ô¼Ó¼õÀ´»ñµÃÒ»¸öеÄÈÕÆÚ¡£ÒªÁ˽â¸ü¶àµÄDATEDIFFºÍDATEADDº¯ÊýÒÔ¼°Ê±¼ä¼ä¸ô¿ÉÒÔÔĶÁ΢ÈíÁª»ú°ïÖú¡£
                                                             


Ïà¹ØÎĵµ£º

¸ßЧSQL²éѯ֮Ë÷Òý£¨VI)

ÎÒÃÇÏÈ¿´ NestedLoop ºÍ MergeJoin µÄËã·¨£¨ÒÔÏÂΪÒýÓ㬼û RicCC µÄ¡¶ ͨÍùÐÔÄÜÓÅ»¯µÄÌìÌà - µØÓü JOIN ·½·¨ËµÃ÷ ¡· ):
==================================
NestedLoop:
   foreach rowA in tableA where tableA.col2=?
    {
    search rowsB from tableB where tab ......

SQL ServerË÷ÒýÔ­Ôò

¾ßÌå³ö´¦²»Ïê¡£
ÈçºÎÈÃÄãµÄSQLÔËÐеøü¿ì
---- ÈËÃÇÔÚʹÓÃSQLʱÍùÍù»áÏÝÈëÒ»¸öÎóÇø£¬¼´Ì«¹Ø×¢ÓÚËùµÃµÄ½á¹ûÊÇ·ñÕýÈ·£¬¶øºöÂÔÁ˲»Í¬µÄʵÏÖ·½·¨Ö®¼ä¿ÉÄÜ´æÔÚµÄÐÔÄܲîÒ죬ÕâÖÖÐÔÄܲîÒìÔÚ´óÐ͵ĻòÊǸ´ÔÓµÄÊý¾Ý¿â»·¾³ÖУ¨ÈçÁª»úÊÂÎñ´¦ÀíOLTP»ò¾ö²ßÖ§³ÖϵͳDSS£©ÖбíÏÖµÃÓÈΪÃ÷ÏÔ¡£±ÊÕßÔÚ¹¤×÷ʵ¼ùÖз¢ÏÖ£¬²»Á¼µÄSQLÍùÍùÀ´×ÔÓÚ² ......

SQL Server 2005 ÖеķÖÇø±íºÍË÷Òý(1)


¹ØÓÚ±¾Îı¾ÎÄËùÃè»æµÄ¹¦Äܺͼƻ®ÊÇÏÂÒ»°æ±¾ SQL Server µÄ¿ª·¢·½Ïò¡£ËüÃDz¢·Ç±¾²úÆ·µÄ˵Ã÷Ê飬ÈçÓиü¸Ä£¬Ë¡²»ÁíÐÐ֪ͨ¡£¶ÔÓÚ×îÖÕ²úÆ·ÊÇ·ñ¾ßÓÐÕâЩ¹¦Äܲ»×öÈκÎÃ÷ʾ»ò°µÊ¾µÄ±£Ö¤¡£¶ÔÓÚijЩ¹¦ÄÜ£¬±¾ÎļÙÉè¶ÁÕßÊìϤ SQL Server 2000 ¹¦ÄܺͷþÎñ¡£Óйر³¾°ÐÅÏ¢£¬Çë·ÃÎÊSQL Server ÍøÕ¾»ò SQL Server 2000 ×ÊÔ´¹¤¾ß°ü¡£Õâ²¢²»Ê ......

Oracle SqlÓÅ»¯±Ê¼Ç(Ò»)


»ù±¾µÄSql±àдעÒâÊÂÏî
¾¡Á¿ÉÙÓÃIN²Ù×÷·û£¬»ù±¾ÉÏËùÓеÄIN²Ù×÷·û¶¼¿ÉÒÔÓÃEXISTS´úÌæ¡£
²»ÓÃNOT IN²Ù×÷·û£¬¿ÉÒÔÓÃNOT EXISTS»òÕßÍâÁ¬½Ó+Ìæ´ú¡£
OracleÔÚÖ´ÐÐIN×Ó²éѯʱ£¬Ê×ÏÈÖ´ÐÐ×Ó²éѯ£¬½«²éѯ½á¹û·ÅÈëÁÙʱ±íÔÙÖ´ÐÐÖ÷²éѯ¡£¶øEXISTÔòÊÇÊ×Ïȼì²éÖ÷²éѯ£¬È»ºóÔËÐÐ×Ó²éѯֱµ½ÕÒµ½µÚÒ»¸öÆ¥ÅäÏî¡£NOT EXISTS±ÈNOT INЧÂÊ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ