cobolдsqlÃüÁî
SQLÖÐWHERE×Ó¾äÖпÉÒÔÀûÓÃLIKEÀ´Æ¥ÅäÏàËƵÄÊý¾ÝÏµ±Ê±Îҵõ½µÄ½áÂÛÊÇ¿ÉÒÔʹÓÃ"%"À´Æ¥Åä×Ö·û´®£¬ÔÚSPUFIÖÐʹÓ㬵ÄÈ·¿ÉÒԵõ½×Ö·û´®Æ¥ÅäµÄЧ¹û¡£È磺
SELECT * from TEST
WHERE TESTID LIKE "CZX%";
ÉÏÃæÕâ¾äÔÚSPUFIÖÐÌá½»Ö´Ðк󣬾ͿÉÒÔ½«TEST±íÖÐËùÓÐTESTIDÖÐËùÓÐÒÔ"CZX"×Ö·û´®¿ªÍ·µÄÏÕÒµ½¡£
È»¶ø£¬ÔÚCOBOLÖÐÖ´ÐÐǶÈëµÄSQLÓï¾äµÄʱºò£¬"%"¾ÍÖ»ÄÜÆ¥ÅäÒ»¸ö»ò¿ÕµÄ×Ö·ûÁË£¬È磺
EXEC SQL
SELECT * from TEST
WHERE TESTID LIKE "CZX%"
END-EXEC.
¾ÍÖ»Äܲéѯ³öÒÔ"CZX"¿ªÍ·µÄÇÒ×îºó³¤¶È²»³¬¹ý4µÄÏî¡£
Ò»¿ªÊ¼µÄʱºòÎÒ²¢Ã»ÓÐ×¢Òâµ½Õâ¸öÎÊÌ⣬Òò´Ë£¬ÔÚÆ¥Åä×Ö·û´®µÄʱºò£¬ÀÏÊDzéѯ²»µ½Ô¤ÆÚµÄÊý¾Ý¡£µ±ÎÒ×îÖÕ·¢ÏÖÕâ¸öÎÊÌâµÄʱºò£¬Ò²Ã»ÕÒµ½¸ÃÓÃʲô·ûºÅÀ´Æ¥Åä×Ö·û´®£¬×îºó£¬ÏëÁËÒ»¸öÀûÓÃ"%"À´Íê³É×Ö·û´®Æ¥ÅäµÄ·½·¨£º
1¡¢ÉùÃ÷Ò»¸ö×Ö·û´®Æ¥ÅäµÄ±äÁ¿£¬³¤¶ÈΪÊý¾Ý¿âÖÐҪƥÅäÏ¶È+2£¬È磺TESTID-FILTERÈ«²¿´æ·Å"%"£»
2¡¢½«´ÓÖն˻ñµÃµÄɸѡ×Ö·û´®,ÈçTESTID-INPUTÈ¥µô¿Õ¸ñºó£¬²åÈëµ½1Öж¨ÒåµÄ±äÁ¿µÄµÚ¶þλ£»
3¡¢µÃµ½×Ö·û´®TESTID-FILTER¾ÍÊÇÓÃÔÚLIKEÖÐÆ¥Åä×Ö·û´®µÄËÞÖ÷±äÁ¿ÁË¡£
Ò²¾ÍÊÇ˵£¬½«Öն˵õ½µÄÊý¾Ý±ä³ÉÐÎÈç"%*******%%%%%%%%%%"ÕâÑùµÄÆ¥Åä×Ö·û´®£¬ÓÃÓÚÊý¾Ý¿âµÄ²éѯ¡£ÕâÑù£¬¾Í¿ÉÒԳɹ¦µÄʵÏÖ²éѯÊý¾Ý¿âÖиÃÏî°üº¬"******"×Ö·û´®µÄËùÓÐÏî¡£
Ïà¹ØÎĵµ£º
ÈçºÎÈÃÄãµÄSQLÔËÐеøü¿ì
---- ÈËÃÇÔÚʹÓÃSQLʱÍùÍù»áÏÝÈëÒ»¸öÎóÇø£¬¼´Ì«¹Ø×¢ÓÚËùµÃµÄ½á¹ûÊÇ·ñÕýÈ·£¬¶øºöÂÔÁ˲»Í¬µÄʵÏÖ·½·¨Ö®¼ä¿ÉÄÜ´æÔÚµÄÐÔÄܲîÒ죬ÕâÖÖÐÔÄܲîÒìÔÚ´óÐ͵ĻòÊǸ´ÔÓµÄÊý¾Ý¿â»·¾³ÖУ¨ÈçÁª»úÊÂÎñ´¦ÀíOLTP»ò¾ö²ßÖ§³ÖϵͳDSS£©ÖбíÏÖµÃÓÈΪÃ÷ÏÔ¡£±ÊÕßÔÚ¹¤×÷ʵ¼ùÖз¢ÏÖ£¬²»Á¼µÄSQLÍùÍùÀ´×ÔÓÚ²»Ç¡µ±µÄË÷ÒýÉè¼Æ¡¢ ......
×÷ÖÐÊý¾Ý¿â¾³£³ö´íËÀËø£¬²¢ÇÒ»¹ÒªÒªÇó½â¾öµ±Ç°µÄËÀËø£¬ÎÊÌâ¶à¶à£»
²ÎÕÕCSDN£¬Öйú·ç(Roy)һƪËÀËøÎÄÕ²¢¸Ä½øÁËÏ£»
/***********************************************************************************************************************
ÕûÀíÈË£ººÚľÑÂÉϵÄÎÏÅ£(lenolotus) ÈÕÆÚ:2009.04.28
************ ......
½ñÌì×öSQL ÓÅ»¯£¬²éÕÒÖ´Ðмƻ®Ê±£¬Ö´Ðмƻ®£¬·¢ÏÖ´ËÖ´Ðмƻ®ÓëÒÔÍùµÄ¼Æ»®ÓÐËùÇø±ð£»ÕÒ¼»¥ÁªÍø£¬ÖÕÓÚÕÒһƪÓйØÑо¿±È½ÏÉîÈëµÄÎÄÕ£»
ÔÖ´Ðмƻ®Ê¹ÓõÄÊÇË÷ÒýɨÃ裬ͻȻһÏ»áʹÓÃË÷Òý¸²¸Ç¼¼Êõ£¬Ð§ÂÊ´óÔö£»
SELECT * µÄÕæÏࣺË÷Òý¸²¸Ç(index coverage)
SELECT *µÄЧÂʺÜÔã¸âÂ𣿵±È»£¬ËùÓÐÈ˶¼ÖªµÀÕâÒ»µã£¬µ«ÊÇΪʲô ......
ÏÈ˵˵ÕâЩÎóÇø¡£Ëùν“ÎóÇø”£¬ÓÐһЩÊÇÐÂÊÖºÜÈÝÒ×·¸µÄ´íÎó»òÕߺÜÈÝÒ׺öÂÔµÄÎÊÌ⣬ÁíÍâһЩ£¬ÔòÊÇÏñ“ºÄ×Ó³ÔÁËÑλá±ä³Éòùòð”Ò»Ñù£¬ÈÃÎÒÃÇ´ÓС¾ÍÈÏΪÊÇÕýÈ·µÄÊÂÇé¡£ÈçÏ£º
1¡¢ ±íÉϲ»¹ÜÓõÃ×ÅÓò»×Å£¬¶¼¼Ó¸ö¾Û¼¯Ë÷Òý¡£
ÎÒÃÇÖªµÀ£¬±íÒÔÁ½ÖÖ·½Ê½×éÖ¯ÎïÀí´æ´¢£ºÓоۼ¯Ë÷ÒýµÄ“¾Û¼¯± ......