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

ÓÅ»¯MYSQLÊý¾Ý¿âµÄ·½·¨

1¡¢Ñ¡È¡×îÊÊÓõÄ×Ö¶ÎÊôÐÔ
¡¡¡¡MySQL¿ÉÒԺܺõÄÖ§³Ö´óÊý¾ÝÁ¿µÄ´æÈ¡£¬µ«ÊÇÒ»°ã˵À´£¬Êý¾Ý¿âÖеıíԽС£¬ÔÚËüÉÏÃæÖ´ÐеIJéѯҲ¾Í»áÔ½¿ì¡£Òò´Ë£¬ÔÚ´´½¨±íµÄʱºò£¬ÎªÁË»ñµÃ¸üºÃµÄÐÔÄÜ£¬ÎÒÃÇ¿ÉÒÔ½«±íÖÐ×ֶεĿí¶ÈÉèµÃ¾¡¿ÉÄÜС¡£ÀýÈ磬ÔÚ¶¨ÒåÓÊÕþ±àÂëÕâ¸ö×Ö¶Îʱ£¬Èç¹û½«ÆäÉèÖÃΪCHAR(255),ÏÔÈ»¸øÊý¾Ý¿âÔö¼ÓÁ˲»±ØÒªµÄ¿Õ¼ä£¬ÉõÖÁʹÓÃVARCHARÕâÖÖÀàÐÍÒ²ÊǶàÓàµÄ£¬ÒòΪCHAR(6)¾Í¿ÉÒԺܺõÄÍê³ÉÈÎÎñÁË¡£Í¬ÑùµÄ£¬Èç¹û¿ÉÒԵĻ°£¬ÎÒÃÇÓ¦¸ÃʹÓÃMEDIUMINT¶ø²»ÊÇBIGINÀ´¶¨ÒåÕûÐÍ×ֶΡ£
¡¡¡¡ÁíÍâÒ»¸öÌá¸ßЧÂʵķ½·¨ÊÇÔÚ¿ÉÄܵÄÇé¿öÏ£¬Ó¦¸Ã¾¡Á¿°Ñ×Ö¶ÎÉèÖÃΪNOT NULL£¬ÕâÑùÔÚ½«À´Ö´ÐвéѯµÄʱºò£¬Êý¾Ý¿â²»ÓÃÈ¥±È½ÏNULLÖµ¡£
¡¡¡¡¶ÔÓÚijЩÎı¾×ֶΣ¬ÀýÈç“Ê¡·Ý”»òÕß“ÐԱ𔣬ÎÒÃÇ¿ÉÒÔ½«ËüÃǶ¨ÒåΪENUMÀàÐÍ¡£ÒòΪÔÚMySQLÖУ¬ENUMÀàÐͱ»µ±×÷ÊýÖµÐÍÊý¾ÝÀ´´¦Àí£¬¶øÊýÖµÐÍÊý¾Ý±»´¦ÀíÆðÀ´µÄËÙ¶ÈÒª±ÈÎı¾ÀàÐÍ¿ìµÃ¶à¡£ÕâÑù£¬ÎÒÃÇÓÖ¿ÉÒÔÌá¸ßÊý¾Ý¿âµÄÐÔÄÜ¡£
2¡¢Ê¹ÓÃÁ¬½Ó£¨JOIN£©À´´úÌæ×Ó²éѯ(Sub-Queries)
¡¡¡¡MySQL´Ó4.1¿ªÊ¼Ö§³ÖSQLµÄ×Ó²éѯ¡£Õâ¸ö¼¼Êõ¿ÉÒÔʹÓÃSELECTÓï¾äÀ´´´½¨Ò»¸öµ¥ÁеIJéѯ½á¹û£¬È»ºó°ÑÕâ¸ö½á¹û×÷Ϊ¹ýÂËÌõ¼þÓÃÔÚÁíÒ»¸ö²éѯÖС£ÀýÈ磬ÎÒÃÇÒª½«¿Í»§»ù±¾ÐÅÏ¢±íÖÐûÓÐÈκζ©µ¥µÄ¿Í»§É¾³ýµô£¬¾Í¿ÉÒÔÀûÓÃ×Ó²éѯÏÈ´ÓÏúÊÛÐÅÏ¢±íÖн«ËùÓз¢³ö¶©µ¥µÄ¿Í»§IDÈ¡³öÀ´£¬È»ºó½«½á¹û´«µÝ¸øÖ÷²éѯ£¬ÈçÏÂËùʾ£º
¡¡¡¡DELETE from customerinfo WHERE CustomerID NOT in (SELECT CustomerID from salesinfo )
¡¡¡¡Ê¹ÓÃ×Ó²éѯ¿ÉÒÔÒ»´ÎÐÔµÄÍê³ÉºÜ¶àÂß¼­ÉÏÐèÒª¶à¸ö²½Öè²ÅÄÜÍê³ÉµÄSQL²Ù×÷£¬Í¬Ê±Ò²¿ÉÒÔ±ÜÃâÊÂÎñ»òÕß±íËøËÀ£¬²¢ÇÒдÆðÀ´Ò²ºÜÈÝÒס£µ«ÊÇ£¬ÓÐЩÇé¿öÏ£¬×Ó²éѯ¿ÉÒÔ±»¸üÓÐЧÂʵÄÁ¬½Ó£¨JOIN£©.. Ìæ´ú¡£ÀýÈ磬¼ÙÉèÎÒÃÇÒª½«ËùÓÐûÓж©µ¥¼Ç¼µÄÓû§È¡³öÀ´£¬¿ÉÒÔÓÃÏÂÃæÕâ¸ö²éѯÍê³É£º
¡¡¡¡SELECT * from customerinfo WHERE CustomerID NOT in (SELECT CustomerID from salesinfo )
¡¡¡¡Èç¹ûʹÓÃÁ¬½Ó£¨JOIN£©.. À´Íê³ÉÕâ¸ö²éѯ¹¤×÷£¬ËٶȽ«»á¿ìºÜ¶à¡£ÓÈÆäÊǵ±salesinfo±íÖжÔCustomerID½¨ÓÐË÷ÒýµÄ»°£¬ÐÔÄܽ«»á¸üºÃ£¬²éѯÈçÏ£º
¡¡¡¡SELECT * from customerinfo LEFT JOIN salesinfoON customerinfo.CustomerID=salesinfo. CustomerID WHERE salesinfo.CustomerID IS NULL
¡¡¡¡Á¬½Ó£¨JOIN£©.. Ö®ËùÒÔ¸üÓÐЧÂÊһЩ£¬ÊÇÒòΪ MySQL²»ÐèÒªÔÚÄÚ´æÖд´½¨ÁÙʱ±íÀ´Íê³ÉÕâ¸öÂß¼­ÉϵÄÐèÒªÁ½¸ö²½ÖèµÄ²éѯ¹¤×÷¡£
3¡¢Ê¹ÓÃÁªºÏ(UNION)À´´úÌæÊÖ¶¯´´½¨µÄÁÙʱ±í
¡¡¡¡MySQ


Ïà¹ØÎĵµ£º

mysqlÔ¶³Ì±¸·Ý

н¨backup.bat
ÉèÖÃmysqldumpÈ«¾Ö»·¾³±äÁ¿»òʹÓÃʱдÈë¾ø¶Ô·¾¶
@echo off
set date0=%date:~0,10%
set time0=%time:~0,8%
set time1=%time:~0,2%
set time2=%time:~3,2%
set time3=%time:~6,2%
echo %time0%
echo %time1%
echo %time2%
echo %time3%
mysqldump -u<Óû§> -p<ÃÜÂë> -h <ip ......

È¡mysql±íºÍ×Ö¶Î×¢Ê͵ÄsqlÓï¾ä

½ñÌìÕÒµ½ÁËÈ¡mysql±íºÍ×Ö¶Î×¢Ê͵ÄÓï¾ä
È¡×Ö¶Î×¢ÊÍ
SELECT COLUMN_NAME ÁÐÃû, DATA_TYPE ×Ö¶ÎÀàÐÍ, COLUMN_COMMENT ×Ö¶Î×¢ÊÍ
from INFORMATION_SCHEMA.COLUMNS
WHERE table_name = 'companies'##±íÃû
AND table_schema = 'testhuicard'##Êý¾Ý¿âÃû
AND column_name LIKE 'c_name'##×Ö¶ÎÃû
--------------------------- ......

MySQL+PHPÂÒÂëÔ­ÀíÓë½â¾ö

±¾ÎÄ´Ó http://tech.ddvip.com/2009-02/1235627800109815.html ×°ÔØ,·Ç³£¸Ðл×÷Õß!
MySQL+PHP²úÉúÂÒÂëÔ­Òò£º
¡¡¡¡¡ô MySQLÊý¾Ý¿âĬÈϵıàÂëÊÇutf8,Èç¹ûÕâÖÖ±àÂëÓëÄãµÄPHPÍøÒ³²»Ò»ÖÂ,¿ÉÄܾͻáÔì³ÉMySQLÂÒÂ룻
¡¡¡¡¡ô MySQLÖд´½¨±íʱ»áÈÃÄãÑ¡ÔñÒ»ÖÖ±àÂë,Èç¹ûÕâÖÖ±àÂëÓëÄãµÄÍøÒ³±àÂë²»Ò»ÖÂ,Ò²¿ÉÄÜÔì³ÉMySQLÂÒÂ룻
¡¡ ......

mysqlÄÚ´æ±íheapʹÓÃ×ܽá


ÄÚ´æ±íʹÓùþϣɢÁÐË÷Òý°ÑÊý¾Ý±£´æÔÚÄÚ´æÖУ¬Òò´Ë¾ßÓм«¿ìµÄËٶȣ¬Êʺϻº´æÖÐСÐÍÊý¾Ý¿â£¬µ«ÊÇʹÓÃÉÏÊܵ½Ò»Ð©ÏÞÖÆ£¬ÒÔÏÂÊÇÀ¶²ÝʹÓõÄһЩ¸ÐÊÜ¡£
1¡¢heap¶ÔËùÓÐÓû§µÄÁ¬½ÓÊǿɼûµÄ£¬ÕâʹµÃËü·Ç³£ÊʺÏ×ö»º´æ¡£
2¡¢½öÊʺÏʹÓõij¡ºÏ¡£heap²»ÔÊÐíʹÓÃxxxTEXTºÍxxxBLOBÊý¾ÝÀàÐÍ£»Ö»ÔÊÐíʹÓÃ=ºÍ<=>²Ù×÷·ûÀ´ËÑË÷¼Ç¼£¨²» ......

sqliteºÍpdo mysqlµÄÊý¾Ý¿â²Ù×÷

½ñÌìµÄѧϰÄÚÈÝÊÇsqliteºÍPDO mysql¡£
ÓÃ×Ô¼ºµÄ»°ËµËµÁ½¸ö¶«Î÷°É£º
sqliteËãÊÇÒ»ÖÖ²»ÏµÍ³µÄÊý¾Ý¿â´æ´¢·½Ê½£¬ËüµÄ´æ·Å¸ñʽÊÇÒ»¸ö.dbºó׺µÄÎļþ£¬ÔÚphpÖÐËü´æ·ÅÔÚµ±Ç°µÄĿ¼Ï£¬Ã²ËƲ»ÓÃÓû§ÃûÃÜÂ룬°²È«ÐԽϵͣ¬È´±È½Ï·½±ã¡£PHP5ÖÐ×Ô´øµÄһЩϵͳº¯Êý£¬¶¼ÊÇÒÔsqlite_¿ªÍ·µÄ¡£
PDOÈ«³ÆPHP Data Object£¬¹ËÃû˼Òå¾ÍÊÇPHPµÄÒ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ