MySQL¶Ô±ê×¼SQLµÄÀ©Õ¹
MySQL·þÎñÆ÷°üº¬Ò»Ð©ÆäËûSQL DBMSÖв»¾ß±¸µÄÀ©Õ¹¡£×¢Ò⣬Èç¹ûʹÓÃÁËËüÃÇ£¬½«ÎÞ·¨°Ñ´úÂëÒÆÖ²µ½ÆäËûSQL·þÎñÆ÷¡£ÔÚijЩÇé¿öÏ£¬Äã¿ÉÒÔ±àд°üº¬MySQLÀ©Õ¹µÄ´úÂ룬µ«ÈÔ±£³ÖÆä¿ÉÒÆÖ²ÐÔ£¬·½·¨ÊÇÓÓ/*... */”×¢Ê͵ôÕâЩÀ©Õ¹¡£MySQL·þÎñÆ÷Äܹ»½âÎö²¢Ö´ÐÐ×¢ÊÍÖеĴúÂ룬¾ÍÏñ¶Ô´ýÆäËûMySQLÓï¾äÒ»Ñù£¬µ«ÆäËûSQL·þÎñÆ÷½«ºöÂÔÕâЩÀ©Õ¹¡£ÀýÈ磺
SELECT /*! STRAIGHT_JOIN */ col_name from table1,table2 WHERE ...
Èç¹ûÔÚ×Ö·û“!”ºóÌí¼ÓÁË°æ±¾ºÅ£¬½öµ±MySQLµÄ°æ±¾µÈÓÚ»ò¸ßÓÚÖ¸¶¨µÄ°æ±¾ºÅʱ²Å»áÖ´ÐÐ×¢ÊÍÖеÄÓï·¨£º
CREATE /*!32302 TEMPORARY */ TABLE t (a INT);
ÕâÒâζ×Å£¬Èç¹ûÄãµÄ°æ±¾ºÅΪ3.23.02»ò¸ü¸ß£¬MySQL·þÎñÆ÷½«Ê¹ÓÃTEMPORARY¹Ø¼ü×Ö¡£
ÏÂÃæ°´Àà±ð½éÉÜÁ˸÷ÖÖMySQLÀ©Õ¹¡£
· ´ÅÅÌÉϵÄÊý¾Ý×éÖ¯
MySQL·þÎñÆ÷»á½«Ã¿¸öÊý¾Ý¿âÓ³Éäµ½MySQLÊý¾ÝĿ¼ÏµÄ1¸öĿ¼ÖУ¬²¢½«Êý¾Ý¿âÖеıíÓ³Éäµ½Êý¾Ý¿âĿ¼ÏµÄÎļþÃû¡£Ëü¾ßÓÐÏÂÊöº¬Ò壺
o Èç¹û²Ù×÷ϵͳµÄÎļþÃûÇø·Ö´óСд£¨Èç´ó¶àÊýUnixϵͳ£©£¬µ±MySQL·þÎñÆ÷ÔËÐÐÔÚÕâÀà²Ù×÷ϵͳÉÏʱ£¬Êý¾Ý¿âÃûºÍ±íÃûÒ²Çø·Ö´óСд¡£
o Äã¿ÉÒÔʹÓñê×¼µÄϵͳÃüÁîÀ´±¸·Ý¡¢ÖØÃüÃû¡¢Òƶ¯¡¢É¾³ý¡¢²¢¿½±´ÓÉMyISAM»òISAM´æ´¢ÒýÇæ¹ÜÀíµÄ±í¡£ÀýÈ磬ҪÏëÖØÃüÃûMyISAM±í£¬¿ÉÖØÃüÃû±í¶ÔÓ¦µÄ.MYD¡¢.MYI¡¢ÒÔ¼°.frmÎļþ¡£
Êý¾Ý¿â¡¢±í¡¢Ë÷Òý¡¢Áлò±ðÃûÄܹ»ÒÔÊý×Ö¿ªÍ·£¨µ«»òÐí²»ÄÜÈ«²¿ÓÉÊý×Ö¹¹³É£©¡£
· ͨÓÃÓïÑÔÓï·¨
o ¿ÉÒÔʹÓÓ””»ò“’”À¨×¡×Ö·û´®£¬¶ø²»½öÊÇ“’”¡£
o ÔÚ×Ö·û´®ÖÐʹÓÓ\”×÷ΪתÒå×Ö·û¡£
o ÔÚSQLÓï¾äÖУ¬¿ÉÒÔʹÓÓdb_name.tbl_name”Óï·¨·ÃÎʲ»Í¬Êý¾Ý¿âÖÐµÄ±í¡£Ä³Ð©SQL·þÎñÆ÷ÌṩÁËÏàͬµÄ¹¦ÄÜ£¬µ«µ÷ÓøÃÓû§¿Õ¼ä³ýÍâ¡£MySQL·þÎñÆ÷²»Ö§³Ö±í¿Õ¼ä£¬ÈçÏÂÊöÓï¾äÖÐʹÓõÄÄÇÑù£º CREATE TABLE ralph.my_table...IN my_tablespace.
· SQLÓï¾äµÄÓï·¨
o ANALYZE TABLE£¬CHECK TABL
Ïà¹ØÎĵµ£º
Ò»
SQLÖظ´¼Ç¼²éѯ£¨×ª×Ôhttp://blog.csdn.net/RainyLin/archive/2009/02/17/3901956.aspx£©
SQLÖظ´¼Ç¼²éѯ
1¡¢²éÕÒ±íÖжàÓàµÄÖظ´¼Ç¼£¬Öظ´¼Ç¼ÊǸù¾Ýµ¥¸ö×ֶΣ¨peopleId£©À´ÅжÏ
select * from people
where peopleId in (select peopleId from people group ......
ûÓÐÒýÓùØϵµÄ±í
£±.¡¡Áª±í¸üÐÂ
update a set a.education = '±¾¿Æ' from NT_UserInfo a ,NT_User b where a.UserID=b.UserID and b.email = 'carlfan2008@163.com'
£².¡¡Áª±í²éѯ
select a.*,b.* from nt_user as a, nt_userinfo as b where a.userid = b.userid and Email = 'carlfan2008@163.com ......
½ñÌìÔÚÐÞ¸ÄÒÔÇ°¿ª·¢µÄÒ»¸öÍøÕ¾µÄʱºòÓöµ½Ò»¸öÎÊÌ⣬ÒòΪ¹¦ÄܵÄÐèÒª£¬ÒÔÇ°µÄÒ»¸öÊý×ÖÀàÐÍ×ֶθıäΪÎı¾×ֶΣ¬ÒòΪÕâ¸ö×Ö¶ÎÐèÒª°üº¬¶à¸öÀà±ðµÄID£¬ÒÔÇ°Õâ¸ö×Ö¶ÎÖ»¶ÔÓ¦Ò»¸öIDµÄ¡£
ÍøÕ¾ÊÇASP VBÓïÑԵģ¬Êý¾Ý¿âʹÓõÄÊÇAccess
ÐÞ¸ÄÊý¾ÝÀàÐÍÖ®ºóǰ̨µÄ²éѯ´úÂë¾Í²»ÄÜʹÓÃÖîÈçxID=1ÕâÖÖÌõ¼þÁË¡£ÓÉÓÚÏÖÔÚ¸Ã×ֶαäΪÎı¾ÀàÐ ......
ÈçºÎÈÃÄãµÄSQLÔËÐеøü¿ì
---- ÈËÃÇÔÚʹÓÃSQLʱÍùÍù»áÏÝÈëÒ»¸öÎóÇø£¬¼´Ì«¹Ø×¢ÓÚËùµÃµÄ½á¹ûÊÇ·ñÕýÈ·£¬¶øºöÂÔ
Á˲»Í¬µÄʵÏÖ·½·¨Ö®¼ä¿ÉÄÜ´æÔÚµÄÐÔÄܲîÒ죬ÕâÖÖÐÔÄܲîÒìÔÚ´óÐ͵ĻòÊǸ´ÔÓµÄÊý¾Ý¿â
»·¾³ÖУ¨ÈçÁª»úÊ ......