Èí¼þ²âÊÔѧϰ֮Êý¾Ý¿â֪ʶÕûÀí
2022-01-08µã»÷Á¿£º74
1¡¢MySQLÖÐÈçºÎʹÓÃÌØÊâ×Ö·û£¿ÖîÈçµ¥ÒýºÅ£¨¡¯£©£¬Ë«ÒýºÅ£¨"£©£¬·´Ð±Ïߣ¨)µÈ·ûºÅ£¬ÕâЩ·ûºÅÔÚMySQLÖв»ÄÜÖ±½ÓÊäÈëʹÓ㬷ñÔò»á²úÉúÒâÁÏÖ®ÍâµÄ½á¹û¡£ÔÚMySQLÖУ¬ÕâЩÌØÊâ×Ö·û³ÆΪתÒå×Ö·û£¬ÔÚÊäÈëʱÐèÒªÒÔ·´Ð±Ïß·ûºÅ£¨¡¯\¡¯£©¿ªÍ·£¬ËùÒÔÔÚʹÓõ¥ÒýºÅºÍË«ÒýºÅʱӦ·Ö±ðÊäÈ루\¡¯£©»òÕߣ¨\")£¬ÊäÈ뷴бÏßʱӦ¸ÃÊäÈ루\)£¬ÆäËûÌØÊâ×Ö·û»¹Óлسµ·û£¨\r)£¬»»Ðзû£¨\n)£¬ÖƱí·û£¨\tab)£¬Í˸ñ·û£¨\b)µÈ¡£ÔÚÏòÊý¾Ý¿âÖвåÈëÕâЩÌØÊâ×Ö·ûʱ£¬Ò»¶¨Òª½øÐÐתÒå´¦Àí¡£2¡¢MySQLÖпÉÒÔ´æ´¢ÎļþÂð£¿MySQLÖеÄBLOBºÍTEXT×Ö¶ÎÀàÐÍ¿ÉÒÔ´æ´¢Êý¾ÝÁ¿½Ï´óµÄÎļþ£¬¿ÉÒÔʹÓÃÕâЩÊý¾ÝÀàÐʹ洢ͼÏñ¡¢ÉùÒô»òÕßÊÇ´óÈÝÁ¿µÄÎı¾ÄÚÈÝ£¬ÀýÈçÍøÒ³»òÕßÎĵµ¡£ËäȻʹÓÃBLOB»òÕßTEXT¿ÉÒÔ´æ´¢´óÈÝÁ¿µÄÊý¾Ý£¬µ«ÊǶÔÕâЩ×ֶεĴ¦Àí»á½µµÍÊý¾Ý¿âµÄÐÔÄÜ¡£Èç¹û²¢·Ç±ØÒª£¬¿ÉÒÔÑ¡ÔñÖ»´¢´æÎļþµÄ·¾¶¡£3¡¢MySQLÖÐÈçºÎÖ´ÐÐÇø·Ö´óСдµÄ×Ö·û´®±È½Ï£¿ÔÚWindowsƽ̨Ï£¬MySQLÊDz»Çø·Ö´óСµÄ£¬Òò´Ë×Ö·û´®±È½Ïº¯ÊýÒ²²»Çø·Ö´óСд¡£Èç¹ûÏëÖ´ÐÐÇø·Ö´óСдµÄ±È½Ï£¬¿ÉÒÔÔÚ×Ö·û´®Ç°ÃæÌí¼ÓBINARY¹Ø¼ü×Ö¡£ÀýÈçĬÈÏÇé¿öÏ£¬¡¯a¡¯=¡®A¡¯·µ»Ø½á¹ûΪ1£¬Èç¹ûʹÓÃBINARY¹Ø¼ü×Ö£¬BINARY¡¯a¡¯=¡®A¡¯½á¹ûΪ0,ÔÚÇø·Ö´óСдµÄÇé¿öÏ£¬¡¯a¡¯Ó롯A¡¯²¢²»Ïàͬ¡£4¡¢ÈçºÎ´ÓÈÕÆÚʱ¼äÖµÖлñÈ¡Äê¡¢Ô¡¢ÈյȲ¿·ÖÈÕÆÚ»òʱ¼äÖµ£¿MySQLÖУ¬ÈÕÆÚʱ¼äÖµÒÔ×Ö·û´®ÐÎʽ´æ´¢ÔÚÊý¾Ý±íÖУ¬Òò´Ë¿ÉÒÔʹÓÃ×Ö·û´®º¯Êý·Ö±ð½ØÈ¡ÈÕÆÚʱ¼äÖµµÄ²»Í¬²¿·Ö£¬ÀýÈçij¸öÃû³ÆΪdtµÄ×Ö¶ÎÓÐÖµ¡°2010-10-0112:00:30¡±£¬Èç¹ûÖ»ÐèÒª»ñµÃÄêÖµ£¬¿ÉÒÔÊäÈëLEFT(dt,4)£¬ÕâÑù¾Í»ñµÃÁË×Ö·û´®×ó±ß¿ªÊ¼³¤¶ÈΪ4µÄ×Ó×Ö·û´®£¬¼´YEAR²¿·ÖµÄÖµ£»Èç¹ûÒª»ñÈ¡Ô·ÝÖµ£¬¿ÉÒÔÊäÈëMID(dt,6,2)£¬×Ö·û´®µÚ6¸ö×Ö·û¿ªÊ¼£¬³¤¶ÈΪ2µÄ×Ó×Ö·û´®ÕýºÃΪdtÖеÄÔ·ÝÖµ¡£Í¬Àí£¬¶ÁÕß¿ÉÒÔ¸ù¾ÝÆäËûÈÕÆÚºÍʱ¼äµÄλÖ㬼ÆËã²¢»ñÈ¡ÏàÓ¦µÄÖµ¡£5¡¢ÈçºÎ¸Ä±äĬÈϵÄ×Ö·û¼¯£¿CONVERT()º¯Êý¸Ä±äÖ¸¶¨×Ö·û´®µÄĬÈÏ×Ö·û¼¯£¬ÔÚ¿ªÊ¼µÄÕ½ÚÖУ¬Ïò¶ÁÕß½éÉÜʹÓÃGUIͼÐλ¯°²×°ÅäÖù¤¾ß½øÐÐMySQLµÄ°²×°ºÍÅäÖã¬ÆäÖеÄÒ»¸ö²½ÖèÊÇ¿ÉÒÔÑ¡ÔñMySQLµÄĬÈÏ×Ö·û¼¯¡£µ«ÊÇ£¬Èç¹ûÖ»¸Ä±ä×Ö·û¼¯£¬Ã»ÓбØÒª°ÑÅäÖùý³ÌÖØÐÂÖ´ÐÐÒ»±é£¬ÔÚÕâÀһ¸ö¼òµ¥µÄ·½Ê½ÊÇÐÞ¸ÄÅäÖÃÎļþ¡£ÔÚWindowsÖУ¬MySQLÅäÖÃÎļþÃû³ÆΪmy.ini£¬¸ÃÎļþÔÚMySQLµÄ°²×°Ä¿Â¼ÏÂÃæ¡£ÐÞ¸ÄÅäÖÃÎļþÖеÄdefault-character-setºÍcharacter-set-server²ÎÊýÖµ£¬½«Æä¸ÄΪÏëÒªµÄ×Ö·û¼¯Ãû³Æ£¬Èçgbk¡¢gb2312¡¢latinlµÈ£¬ÐÞ¸ÄÍêÖ®ºóÖØÐÂÆô¶¯MySQL·þÎñ£¬¼´¿ÉÉúЧ¡£¶ÁÕß¿ÉÒÔÔÚÐÞ¸Ä×Ö·û¼¯Ê±Ê¹ÓÃSHOWVARIABLESLIKE¡¯character_set_¡ã%¡¯;ÃüÁî²é¿´µ±Ç°×Ö·û¼¯£¬ÒÔ½øÐжԱȡ£6¡¢DISTINCT¿ÉÒÔÓ¦ÓÃÓÚËùÓеÄÁÐÂ𣿲éѯ½á¹ûÖУ¬Èç¹ûÐèÒª¶ÔÁнøÐнµÐòÅÅÐò£¬¿ÉÒÔʹÓÃDESC£¬Õâ¸ö¹Ø¼ü×ÖÖ»ÄܶÔÆäÇ°ÃæµÄÁнøÐнµÐòÅÅÁС£ÀýÈ磬Ҫ¶Ô¶àÁж¼½øÐнµÐòÅÅÐò£¬±ØÐëÒªÔÚÿһÁеÄÁÐÃûºóÃæ¼ÓDESC¹Ø¼ü×Ö¡£¶øDISTINCT²»Í¬£¬DISTINCT²»Äܲ¿·ÖʹÓ᣻»¾ä»°Ëµ£¬DISTINCT¹Ø¼ü×ÖÓ¦ÓÃÓÚËùÓÐÁжø²»½öÊÇËüºóÃæµÄµÚÒ»¸öÖ¸¶¨ÁС£ÀýÈ磬²éѯ3¸ö×Ö¶Îs_id£¬f_name£¬f_price£¬Èç¹û²»Í¬¼Ç¼µÄÕâ3¸ö×ֶεÄ×éºÏÖµ¶¼²»Í¬£¬ÔòËùÓмǼ¶¼»á±»²éѯ³öÀ´¡£7¡¢ORDERBY¿ÉÒÔºÍLIMIT»ìºÏʹÓÃÂð£¿ÔÚʹÓÃORDERBY×Ó¾äʱ£¬Ó¦±£Ö¤ÆäλÓÚFROM×Ó¾äÖ®ºó£¬Èç¹ûʹÓÃLIMIT£¬Ôò±ØÐëλÓÚORDERBYÖ®ºó£¬Èç¹û×Ó¾ä˳Ðò²»ÕýÈ·£¬MySQL½«²úÉú´íÎóÏûÏ¢¡£8¡¢Ê²Ã´Ê±ºòʹÓÃÒýºÅ£¿ÔÚ²éѯµÄʱºò£¬»á¿´µ½ÔÚWHERE×Ó¾äÖÐʹÓÃÌõ¼þ£¬ÓеÄÖµ¼ÓÉÏÁ˵¥ÒýºÅ£¬¶øÓеÄֵδ¼Ó¡£µ¥ÒýºÅÓÃÀ´ÏÞ¶¨×Ö·û´®£¬Èç¹û½«ÖµÓë×Ö·û´®ÀàÐÍÁнøÐбȽϣ¬ÔòÐèÒªÏÞ¶¨ÒýºÅ£»¶øÓÃÀ´ÓëÊýÖµ½øÐбȽÏÔò²»ÐèÒªÓÃÒýºÅ¡£9¡¢ÔÚWHERE×Ó¾äÖбØÐëʹÓÃÔ²À¨ºÅÂð£¿ÈκÎʱºòʹÓþßÓÐANDºÍOR²Ù×÷·ûµÄWHERE×Ӿ䣬¶¼Ó¦¸ÃʹÓÃÔ²À¨ºÅÃ÷È·²Ù×÷˳Ðò¡£Èç¹ûÌõ¼þ½Ï¶à£¬¼´Ê¹ÄÜÈ·¶¨¼ÆËã´ÎÐò£¬Ä¬ÈϵļÆËã´ÎÐòÒ²¿ÉÄÜ»áʹSQLÓï¾ä²»Ò×Àí½â£¬Òò´ËʹÓÃÀ¨ºÅÃ÷È·²Ù×÷·ûµÄ´ÎÐò£¬ÊÇÒ»¸öºÃµÄÏ°¹ß¡£10¡¢¸üлòÕßɾ³ý±íʱ±ØÐëÖ¸¶¨WHERE×Ó¾äÂð£¿ÔÚÇ°ÃæÕ½ÚÖпÉÒÔ¿´µ½£¬ËùÓеÄUPDATEºÍDELETEÓï¾äÈ«¶¼ÔÚWHERE×Ó¾äÖÐÖ¸¶¨ÁËÌõ¼þ¡£Èç¹ûÊ¡ÂÔWHERE×Ӿ䣬ÔòUPDATE»òDELETE½«±»Ó¦Óõ½±íÖÐËùÓеÄÐС£Òò´Ë£¬³ý·Çȷʵ´òËã¸üлòÕßɾ³ýËùÓмǼ£¬·ñÔòҪעÒâʹÓò»´øWHERE×Ó¾äµÄUPDATE»òDELETEÓï¾ä¡£½¨ÒéÔÚ¶Ô±í½øÐиüкÍɾ³ý²Ù×÷֮ǰ£¬Ê¹ÓÃSELECTÓï¾äÈ·ÈÏÐèҪɾ³ýµÄ¼Ç¼£¬ÒÔÃâÔì³ÉÎÞ·¨Íì»ØµÄ½á¹û¡£±¾ÎÄÓÉÅàѵÎÞÓÇÍøǧ·æ½ÌÓýרÊô¿Î³Ì¹ËÎÊÕûÀí·¢²¼£¬Ï£ÍûÄܹ»¶ÔÏëѧϰÈí¼þ²âÊÔÅàѵµÄͬѧÓÐËù°ïÖú¡£¸ü¶àÈí¼þ²âÊÔÅàѵ¿Î³Ì»¶Ó¹Ø×¢ÅàѵÎÞÓÇÍøÈí¼þ²âÊÔÅàѵÅàѵƵµÀ»òÌí¼ÓÀÏʦ΢ÐÅ£º15033336050...