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

mysqlÀàÐÍת»»

MYSQL Castº¯Êý ÀàÐÍת»»
BINARY
BINARY²Ù×÷·û½«ºóÃæµÄ×Ö·û´®Å׸øÒ»¸ö¶þ½øÖÆ×Ö·û´®¡£ÕâÊÇÒ»ÖÖ¼òµ¥µÄ·½Ê½À´´ÙʹÖð×Ö½Ú¶ø²»ÊÇÖð×Ö·ûµÄ½øÐÐÁбȽϡ£ÕâʹµÃ±È½ÏÇø·Ö´óСд£¬¼´Ê¹¸ÃÁв»±»¶¨ÒåΪ BINARY»ò BLOB¡£BINARYÒ²»á²úÉú½áβ¿Õ°×£¬´Ó¶ø¸ü¼ÓÏÔÑÛ¡£
mysql> SELECT 'a' = 'A';
-> 1
mysql> SELECT BINARY 'a' = 'A';
-> 0
mysql> SELECT 'a' = 'a ';
-> 1
mysql> SELECT BINARY 'a' = 'a ';
-> 0
BINARYÓ°ÏìÕû¸ö±È½Ï£»Ëü¿ÉÒÔÔÚÈκβÙ×÷ÊýÇ°±»¸ø¶¨£¬¶ø²úÉúÏàͬµÄ½á¹û¡£
BINARY str ÊÇCAST(str AS BINARY)µÄËõÂÔÐÎʽ¡£
×¢Ò⣬ÔÚһЩÓï¾³ÖУ¬¼ÙÈçÄ㽫һ¸ö±àÈëË÷ÒýµÄÁÐÅɸøBINARY, MySQL ½«²»ÄÜÓÐЧʹÓÃÕâ¸öË÷Òý¡£
¼ÙÈçÄãÏëÒª½«Ò»¸ö BLOBÖµ»òÆäËü¶þ½øÖÆ×Ö·û´®½øÐÐÇø·Ö´óСдµÄ±È½Ï£¬Äã¿ÉÀûÓöþ½øÖÆ×Ö·û´®Ã»ÓÐ×Ö·û¼¯ÕâÒ»ÊÂʵʵÏÖÕâ¸öÄ¿µÄ£¬ÕâÑù¾Í²»»áÓÐÎÄÊé¼ÐµÄ¸ÅÄΪִÐÐÒ»¸öÇø·Ö´óСдµÄ±È½Ï£¬¿ÉʹÓà CONVERT()º¯Êý½«Ò»¸ö×Ö·û´®Öµ×ª»¯ÎªÒ»¸ö²»Çø·Ö´óСдµÄ×Ö·û¼¯¡£Æä½á¹ûΪһ¸ö·Ç¶þ½øÖÆ×Ö·û´®£¬Òò´Ë LIKE ²Ù×÷Ò²²»»áÇø·Ö´óСд£º
SELECT 'A' LIKE CONVERT(blob_col USING latin1) from tbl_name;
ÈôҪʹÓÃÒ»¸ö²»Í¬µÄ×Ö·û¼¯, Ìæ»»ÆäÔÚÉÏÊöÓï¾äÖеÄlatin1Ãû¡£
CONVERT()Ò»°ã¿ÉÓÃÓڱȽϳöÏÖÔÚ²»Í¬×Ö·û¼¯ÖеÄ×Ö·û´®¡£
CAST(expr AS type), CONVERT(expr,type) , CONVERT(expr USING transcoding_name)
CAST() ºÍCONVERT() º¯Êý¿ÉÓÃÀ´»ñÈ¡Ò»¸öÀàÐ͵ÄÖµ£¬²¢²úÉúÁíÒ»¸öÀàÐ͵ÄÖµ¡£
Õâ¸öÀàÐÍ ¿ÉÒÔÊÇÒÔÏÂÖµÆäÖÐµÄ Ò»¸ö£º
BINARY[(N)]
CHAR[(N)]
DATE
DATETIME
DECIMAL
SIGNED [INTEGER]
TIME
UNSIGNED [INTEGER]
BINARY ²úÉúÒ»¸ö¶þ½øÖÆ×Ö·û´®¡£¹ØÓÚËüÔõÑùÓ°Ïì±È½Ï½á¹ûµÄ˵Ã÷¼û±¾ÕÂÖÐ BINARY²Ù×÷·ûÏî¡£
¼ÙÈç¸ø¶¨ÁËËæÒⳤ¶ÈN£¬Ôò BINARY[N] ʹ castʹÓøòÎÊýµÄ²»¶àÓÚ N ¸ö×Ö½Ú¡£Í¬ÑùµÄ£¬ CHAR[N]»áʹ cast ʹÓøòÎÊýµÄ²»¶àÓÚN ¸ö×Ö·û¡£
CAST() and CONVERT(... USING ...) ÊDZê×¼ SQLÓï·¨¡£CONVERT()µÄ·ÇUSING ¸ñʽÊÇofis ODBCÓï·¨¡£
´øÓÐUSINGµÄCONVERT() ±»ÓÃÀ´ÔÚ²»Í¬µÄ×Ö·û¼¯Ö®¼äת»¯Êý¾Ý¡£ÔÚ MySQLÖÐ, ×Ô¶¯ÒëÂëÃûºÍÏàÓ¦µÄ×Ö·û¼¯Ãû³ÆÏàͬ¡£ÀýÈç¡£ Õâ¸öÓï¾ä½«·þÎñÆ÷µÄĬÈÏ×Ö·û¼¯ÖеÄ×Ö·û´® 'abc'ת»¯Îªutf8×Ö·û¼¯ÖÐÏàÓ¦µÄ×Ö·û´®£º
SELECT CONVERT('abc' USING utf8);
µ±ÄãÏëÒªÔÚÒ»¸öCREATE ... SELECT Óï¾äÖд´½¨Ò»¸öÌØÊâÀàÐ͵ÄÁУ¬Ôòcastº¯Êý»áºÜÓÐÓãº
CREATE T


Ïà¹ØÎĵµ£º

ÍùMYSQLÀïдÖÐÎľͱäÎʺţ¿

ÎÊÌâ½â¾öÁË£¬Ô­ÒòÊÇÔÚmy.cnfÖÐȱÉÙÁËÈçÏ´úÂ룺
[client]
default-character-set=utf8
[mysqld]
default-character-set=utf8
Èç¹û²»¼ÓÒÔÉÏ´úÂ룬ÄÇô¼´±ãMYSQL±àÒ밲װʱָ¶¨µÄ±àÂëÊÇUTF8£¬ÄÇôÔÚ½¨¿âʱÆäĬÈϱàÂëÈÔÊÇLATIN1£¬¶øÓÉÓÚ×Ö·û¼¯µÄ¼Ì³ÐÐÔ£¬¿âÖеıíÒ²ÊÇLATIN1µÄÁË¡£
ÕâÀïÁм¸ÌõÃüÁ´ó¼Ò¿ÉÒÔ×Ô¼ºÊÔÏ ......

ÆäËûÊý¾Ý¿âÄ£ÄâʵÏÖmysqlµÄlimitÓï·¨

¼ÙÈçÎÒÓиöuser±í,ÎÒÏë²éѯ·ûºÏijЩÌõ¼þµÄµÚ50¸öÓû§¿ªÊ¼µÄ10¸öÓû§,ÇÒ²»ÄÜʹÓÃidºÅbetween andÄÇÑù²éѯ,Ó¦¸ÃÔõôдSQLÓï¾ä?
¡¡¡¡ÔÚmysqlÊý¾Ý¿âÖÐÓÐlimit,offsetÓï¾ä¿ÉÒÔ·½±ãµÄʵÏÖ,ÄÇôÔÚSQL serverÖÐÄØ?SQL ServerÊÇ·ñÖ§³ÖlimitºÍoffsetÓï¾äÄØ?
select top 10 * from
(select top 60 * from [user] order by userid) a ......

ExcelÊý¾ÝʹÓÃjdbcÖ±½Ó²åÈëMysqlÊý¾Ý¿â

import java.io.File;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import jxl.*;
public class ImportExcel {
public static void main(String[] args) {
File importExcel = new File("D:\\test\\test.xls");
try {
// Êý¾Ý¿âÁ¬½Ó
Class.forNa ......

php+mysql×¢ÉäÓï¾ä¹¹Ôì¼¼Êõ

ºÚ¿ÍÈëÃż¼ÊõÖ®php+mysql×¢ÉäÓï¾ä¹¹Ô죺
Ò».Ç°ÑÔ£º
²âÊÔ°æ±¾ÐÅÏ¢£ºOkphp BBS v1.3 ¿ªÔ´°æ
ÓÉÓÚPHPºÍMYSQL±¾ÉíµÃÔ­Òò,PHP+MYSQLµÄ×¢ÉäÒª±ÈaspÀ§ÄÑ£¬ÓÈÆäÊÇ×¢ÉäʱÓï¾äµÄ¹¹Ôì·½Ãæ¸üÊǸöÄѵ㣬±¾ÎÄÖ÷ÒªÊǽè¶ÔOkphp BBS v1.3һЩÎļþµÃ¼òµ¥·ÖÎö£¬À´Ì¸Ì¸php+mysql×¢ÉäÓï¾ä¹¹Ô췽ʽ£¬Ï£Íû±¾ÎĶÔÄãÓеã°ïÖú¡£
¡¡¡¡ÉùÃ÷£ºÎÄÕÂËùÓ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ