mysqlµÄÖÐÎÄÂÒÂëÎÊÌâ
Õâ¶Îʱ¼ä±»Õâ¸öÀ§ÈÅÁ˺ܾã¬Í¨¹ýÐÞ¸ÄÅäÖÃÎļþ£¬ÖÕÓÚ°ÑÕâ¸öÎÊÌâ½â¾öÁË¡£
×Ô¼ºÔÚÍøÉÏÒ²ÕÒÁ˺ܶà¹ØÓÚ½â¾öÕâ¸öÎÊÌâµÄ·½·¨£¬µ«ÊǶ¼½²µÄ²»Ì«Çå³þ£¬ËùÒÔ½ñÌìÔÚÕâÖØÐÂ˵ÏÂÕâ¸öÎÊÌâ¡£
ÎҵĽâ¾ö·½·¨ÊÇͨ¹ýÐÞ¸ÄmysqlµÄÅäÖÃÎļþmy.ini£¬·½·¨ÈçÏ£º
ÔÚmy.iniÖпÉÒÔ·¢ÏÖÓÐÕâôһ¶Î´úÂ룺
[client]
port=3306
[mysql]
default-character-set=latin1
default-character-set=latin1
Õâ¶Î´úÂëµÄÒâ˼ÊDZíʾÔÚmysql¿Í»§¶Ë£¨¼´mysqlµÄdos½çÃ棩ÖеÄ×Ö·û±àÂ룬¼´Îªlatin1(ISO-8859-1:µ¥×Ö½Ú±àÂ뷽ʽ),°Ñlatin1±àÂë¸ÄΪgbk£¨ÖÐÎıàÂëÀ©Õ¹¹ú¼Ò±ê×¼£¬¼æÈÝGB2312£¬¾ÍÊÇÖ»ÄÜÕý³£ÏÔʾÖÐÎĺÍÓ¢ÎÄ£©ºó£¬È»ºóÏȽ«mysql·þÎñÆ÷Í£Ö¹ºó£¬ÔÙÆô¶¯£¬ÔÚ¿Í»§¶ËÖоͿÉÒÔÊäÈëÖÐÎÄÁË¡£
# The default character set that will be used when a new schema or table is
# created and no character set is defined
default-character-set=utf8
default-character-set=utf8
Õâ¶Î´úÂëµÄÒâ˼ÊDZíʾmysql serverµÄ×Ö·û±àÂ룬utf8¿ÉÒÔ±£´æÈ«ÊÀ½ç¸÷¹úµÄÎÄ×Ö£¬Èç¹ûÄãµÄ³ÌÐòÏëÒªÖ§³Ö¹ú¼Ê»¯£¬µ×²ãµÄÊý¾Ý¿âÒ»¶¨Òª´æutf8±àÂ룬¾Í²»Òª¸ÄÁË¡£
ÕâÁ½ÕߵĹØϵ¿ÉÒÔÕâÑùÀí½â£ºutf8 <- gbk
µ±ÎÒÃÇÔÚ¿Í»§¶Ë(Æäʵ¾ÍÊÇmysqlµÄÒ»¸ödos½çÃæ)ÇÃgbkµÄʱºò£¬Ëü¿ÉÒ԰ѱàÂë×Ô¶¯×ª»»Îªutf8´¢´æ½øµ×²ãÊý¾Ý¿â¡£
½â¾öÁËÕâ¸öÎÊÌ⣬ÔÚÕâºÍ´ó¼Ò·ÖÏíÏÂ....
Ïà¹ØÎĵµ£º
Ò»¡¢INSERTºÍREPLACE
INSERTºÍREPLACEÓï¾äµÄ¹¦Äܶ¼ÊÇÏò±íÖвåÈëеÄÊý¾Ý¡£ÕâÁ½ÌõÓï¾äµÄÓï·¨ÀàËÆ¡£ËüÃǵÄÖ÷ÒªÇø±ðÊÇÈçºÎ´¦ÀíÖظ´µÄÊý¾Ý¡£
1. INSERTµÄÒ»°ãÓ÷¨
MySQLÖеÄINSERTÓï¾äºÍ±ê×¼µÄINSERT²»Ì«Ò»Ñù£¬ÔÚ±ê×¼µÄSQLÓï¾äÖУ¬Ò»´Î²åÈëÒ»Ìõ¼Ç¼µÄINSERTÓï¾äÖ»ÓÐÒ»ÖÖÐÎʽ¡£
INSERT INTO tablename(ÁÐÃû…) ......
http://hi.baidu.com/xuwanbest/blog/item/193fd93dda509303bba167e3.html
http://wangdei.javaeye.com/blog/214265
¹ØÓÚ MySQL µ÷ÓÅ
ÓÐ 3 ÖÖ·½·¨¿ÉÒÔ¼Ó¿ì MySQL ·þÎñÆ÷µÄÔËÐÐËٶȣ¬Ð§Âʴӵ͵½¸ßÒÀ´ÎΪ£º
Ìæ»»ÓÐÎÊÌâµÄÓ²¼þ¡£
¶Ô MySQL ½ø³ÌµÄÉèÖýøÐе÷ÓÅ¡£
¶Ô²éѯ½øÐÐÓÅ»¯¡£
ǨÒƵ½ DB2
ÄúÕýÔÚÑ°ÕÒÒ»Öָɾ»À ......
Ëû½«¶à¸ö±íÔÚÂß¼Éϵ±×÷Ò»¸ö±íÀ´²éѯ¡£Ëû½¨Á¢ºóÓÐÁ½¸öÎļþ£¬
¡¡¡¡.frm ±í½á¹¹¶¨Òå
¡¡¡¡.mrg union±íµÄÃû×ÖÇåµ¥
¡¡¡¡Á½¸ö»ù±¾±í:
¡¡¡¡CREATE TABLE TEST_MERGE_1(
¡¡¡¡ID INT(5) NOT NULL,
¡¡¡¡VALUE VARCHAR(100) NOT NULL,
¡¡¡¡PRIMARY KEY(ID)
¡¡¡¡)
¡¡¡¡CREATE TABLE TEST_MERGE_2(
¡¡¡¡ID INT(5) NOT N ......
×î½üÒ»Ö±ÔÚ½øÐÐPenroseÁ¬½ÓMysqlµÄ³¢ÊÔ£¬¿É×ÜÊÇÌáʾÎÞ·¨Á¬½Óµ½Mysql£¬ÎÞÂÛÊǼì²é¶Ë¿ÚÊÇ·ñ¿ªÆô£¬ÉèÖÃMysqlÔ¶³Ì·ÃÎÊȨÏ޵ȶ¼²»¹ÜÓ㬺óÀ´ÔÚPenroseµÄ¹ÙÍøÕÒµ½Ò»¸ö½¨Á¢ÑùÀýÊý¾Ý¿â¼°ÉèÖÃÔ¶³ÌÁ¬½ÓµÄÎĵµ£¬Ã»Ïëµ½Ò»¾Ù³É¹¦£¬Í´¿ì°¡£¡
ÏÂÃæ¾Í°ÑÎĵµºÍ´ó¼Ò¹²Ïíһϣ¡£¨ÊÇÓ¢ÎÄ£¬´ó¼Ò¾Í´ÕºÏ×Å¿´Ï°ɣ¡ÒòΪ×î½ü¸ãPenroseÌ«ÀÛÁË£¬ ......
¶ÔÓÚÕë¶Ô×Ö·û´®Î»ÖõIJÙ×÷£¬µÚÒ»¸öλÖñ»±ê¼ÇΪ1¡£
ASCII(str) ·µ»Ø×Ö·û´®strµÄ×î×óÃæ×Ö·ûµÄASCII´úÂëÖµ¡£Èç¹ûstrÊÇ¿Õ×Ö·û´®£¬·µ»Ø0¡£Èç¹ûstrÊÇNULL£¬·µ»ØNULL¡£
mysql> select ASCII('2');
-> 50
mysql> select ASCII(2);
-> 50
mysql> select ASCII('dx');
-> 100
Ò² ......