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

MysqlµÄ×Ö·û´®º¯Êý

ǰע£º¶ÔÓÚÕë¶Ô×Ö·û´®Î»Öõ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
Ò²¿É²Î¼ûORD()º¯Êý¡£
ORD(str) Èç¹û×Ö·û´®str×î×óÃæ×Ö·ûÊÇÒ»¸ö¶à×Ö½Ú×Ö·û£¬Í¨¹ýÒÔ¸ñʽ((first byte ASCII code)*256+(second byte ASCII code))[*256+third byte ASCII code...]·µ»Ø×Ö·ûµÄASCII´úÂëÖµÀ´·µ»Ø¶à×Ö½Ú×Ö·û´úÂë¡£Èç¹û×î×óÃæµÄ×Ö·û²»ÊÇÒ»¸ö¶à×Ö½Ú×Ö·û¡£·µ»ØÓëASCII()º¯Êý·µ»ØµÄÏàֵͬ¡£
mysql> select ORD('2');
-> 50

CONV(N,from_base,to_base) ÔÚ²»Í¬µÄÊý×Ö»ùÖ®¼ä±ä»»Êý×Ö¡£·µ»ØÊý×ÖNµÄ×Ö·û´®Êý×Ö£¬´Ófrom_base»ù±ä»»Îªto_base»ù£¬Èç¹ûÈκβÎÊýÊÇNULL£¬·µ»ØNULL¡£²ÎÊýN½âÊÍΪһ¸öÕûÊý£¬µ«ÊÇ¿ÉÒÔÖ¸¶¨ÎªÒ»¸öÕûÊý»òÒ»¸ö×Ö·û´®¡£×îС»ùÊÇ2ÇÒ×î´óµÄ»ùÊÇ36¡£Èç¹ûto_baseÊÇÒ»¸ö¸ºÊý£¬N±»ÈÏΪÊÇÒ»¸öÓзûºÅÊý£¬·ñÔò£¬N±»µ±×÷ÎÞ·ûºÅÊý¡£ CONVÒÔ64λµã¾«¶È¹¤×÷¡£
mysql> select CONV("a",16,2);
-> '1010'
mysql> select CONV("6E",18,8);
-> '172'
mysql> select CONV(-17,10,-18);
-> '-H'
mysql> select CONV(10+"10"+'10'+0xa,10,10);
-> '40'

BIN(N) ·µ»Ø¶þ½øÖÆÖµNµÄÒ»¸ö×Ö·û´®±íʾ£¬ÔÚ´ËNÊÇÒ»¸ö³¤ÕûÊý(BIGINT)Êý×Ö£¬ÕâµÈ¼ÛÓÚCONV(N,10,2)¡£Èç¹ûNÊÇNULL£¬·µ»ØNULL¡£
mysql> select BIN(12);
-> '1100'
OCT(N) ·µ»Ø°Ë½øÖÆÖµNµÄÒ»¸ö×Ö·û´®µÄ±íʾ£¬ÔÚ´ËNÊÇÒ»¸ö³¤ÕûÐÍÊý×Ö£¬ÕâµÈ¼ÛÓÚCONV(N,10,8)¡£Èç¹ûNÊÇNULL£¬·µ»ØNULL¡£
mysql> select OCT(12);
-> '14'

HEX(N) ·µ»ØÊ®Áù½øÖÆÖµNÒ»¸ö×Ö·û´®µÄ±íʾ£¬ÔÚ´ËNÊÇÒ»¸ö³¤ÕûÐÍ(BIGINT)Êý×Ö£¬ÕâµÈ¼ÛÓÚCONV(N,10,16)¡£Èç¹ûNÊÇNULL£¬·µ»ØNULL¡£
mysql> select HEX(255);
-> 'FF'

CHAR(N,...) CHAR()½«²ÎÊý½âÊÍΪÕûÊý²¢ÇÒ·µ»ØÓÉÕâЩÕûÊýµÄASCII´úÂë×Ö·û×é³ÉµÄÒ»¸ö×Ö·û´®¡£NULLÖµ±»Ìø¹ý¡£
mysql> select CHAR(77,121,83,81,'76');
-> 'MySQL'
mysql> select CHAR(77,77.3,'77.3');
-> 'MMM'

CONCAT(str1,str2,...) ·µ»ØÀ´×ÔÓÚ²ÎÊýÁ¬½áµÄ×Ö·û´®¡£Èç¹ûÈκβÎÊýÊÇNULL£¬·µ»ØNULL¡£¿ÉÒÔÓг¬¹ý


Ïà¹ØÎĵµ£º

mysql utf 8 ÂÒÂë½â¾ö======ÕýÈ·µÄ

mysql utf-8 ÂÒÂë½â¾ö
Êý¾Ý¿â 2009-09-15 12:34:33 ÔĶÁ327 ÆÀÂÛ0 ×ֺţº´óÖÐС
ÔÚÍøÉÏ¿´¹ýºÜ¶à½â¾ömysqlÂÒÂëµÄÌû×Ó£¬¿ÉÊÇдµÄ²»ÊÇÂÞÀïÂÞà¾͹ýÓÚ¸´ÔÓ¡£ÆäʵÂÒÂëûÄÇô¸´ÔÓ£¬ÊÇÍøÉϵĴóÏÀÃÇÏë¶àÁË¡£ÎÒÑо¿¹ýÒ»¶ÎÈÕ×Ó£¬×ܽá³öÒ»Ì××Ô¼ºµÄ½â¾ö·½°¸£¬Èç¹ûÄ㻹û½â¾öÂÒÂë¾ÍÓÃÎҵķ½·¨ÊÔһϡ£Îҵķ½°¸²»ÊÇ×îºÃµÄ£¬È´ÊÇ×î¼òµ¥Ò ......

mysqlÆô¶¯Åöµ½¹ýµÄÎÊÌâ

ÎÒµÄmysql×°ÔÚ/usr/local/mysqlĿ¼ÏÂÆô
¶¯Åöµ½¹ýºÜ¶àÎÊÌâ¡£×î³£¼ûµÄÊÇ£º
ERROR 2002: Can't connect to local MySQL server through socket
'/tmp/mysql.sock' (111)
½â¾ö°ì·¨£º
[root@test mysql]# /usr/local/mysql/bin/mysqladmin -u root /
>  -S /var/lib/mysql/mysql.sock password 'your.passwd' ......

MySQLµÄ±íËøÎÊÌâ

ÔÚmysqlÊÖ²áÀïÃæÓÐÒ»¶ÎÃèÊö¹ØÓÚlock tablesµÄÓï·¨µÄ.
LOCK TABLES    tbl_name [AS alias] {READ [LOCAL] | [LOW_PRIORITY] WRITE}    [, tbl_name [AS alias] {READ [LOCAL] | [LOW_PRIORITY] WRITE}] ...UNLOCK TABLESREAD
µ±±í²»´æÔÚ WRITE Ð´ËøÊ± READ ¶ÁËø±»Ö´ÐÐ,Õâ¸Ã״̬ÏÂ,µ±Ç°Ïß³Ì ......

DiggÓÃNoSQLÌæ´úMySQL ÄÏÈý·½


     ¼ÌTwitterÖ®ºó£¬Éç½»ÐÂÎÅÍøÕ¾Digg¾ö¶¨¸úMySQL˵ÔÙ¼û£¬²¢Ìæ»»µôËüµÄ´ó²¿·Ö»ù´¡ÉèÊ©×é³É£¬Digg½«´ÓLAMP£¨Linux¡¢ Apache¡¢MySQLºÍPerl/PHP/Python£©¼Ü¹¹Ç¨ÒƵ½»ùÓÚCassandraµÄNoSQL¼Ü¹¹¡£
¡¡¡¡Apache CassandraÊÇÒ»Ì׿ªÔ´·Ö²¼Ê½Êý¾Ý¿â¹ÜÀíϵͳ£¬×î³õÓÉFacebook¿ª·¢£¬ÓÃÓÚ´¢´æÌرð´óµÄÊý¾Ý¡£Cassa ......

MySQLº¯Êý´óÈ«

MySQL±ØÒªÊ±×Ô¶¯±ä»»Êý×ÖΪ×Ö·û´®£¬²¢ÇÒ·´¹ýÀ´Ò²Èç´Ë£º
mysql> SELECT 1+"1";
        -> 2
mysql> SELECT CONCAT(2,' test');
        -> '2 test'
Èç¹ûÄãÏëÒªÃ÷È·µØ±ä»»Ò»¸öÊý×Öµ½Ò»¸ö×Ö·û´®£¬°ÑËü×÷Ϊ²ÎÊý´«µÝµ½CONCAT()¡£
Èç¹û×Ö·û´® ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ