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
Ïà¹ØÎĵµ£º
create PROCEDURE pagelist
@tablename nvarchar(50),
@fieldname nvarchar(50)='*',
@pagesize int output,--ÿҳÏÔʾ¼Ç¼ÌõÊý
@currentpage int output,--µÚ¼¸Ò³
@orderid nvarchar(50),--Ö÷¼üÅÅÐò
@sort int,--ÅÅÐò·½Ê½£¬1±íʾÉýÐò£¬0±íʾ½µÐòÅÅÁÐ
......
Ò»¡¢×Ö·ûת»»º¯Êý
1¡¢ASCII()
·µ»Ø×Ö·û±í´ïʽ×î×ó¶Ë×Ö·ûµÄASCII ÂëÖµ¡£ÔÚASCII£¨£©º¯ÊýÖУ¬´¿Êý×ÖµÄ×Ö·û´®¿É²»ÓÑ’À¨ÆðÀ´£¬µ«º¬ÆäËü×Ö·ûµÄ×Ö·û´®±ØÐëÓÑ’À¨ÆðÀ´Ê¹Ó㬷ñÔò»á³ö´í¡£
2¡¢CHAR()
½«ASCII Âëת»»Îª×Ö·û¡£Èç¹ûûÓÐÊäÈë0 ~ 255 Ö®¼äµÄASCII ÂëÖµ£¬CHAR£¨£© ·µ»ØNULL ¡£
3¡¢LOWER()ºÍ ......
SQLÖظ´¼Ç¼²éѯ
1¡¢²éÕÒ±íÖжàÓàµÄÖظ´¼Ç¼£¬Öظ´¼Ç¼ÊǸù¾Ýµ¥¸ö×ֶΣ¨peopleId£©À´ÅжÏ
select * from
people
where peopleId in (select peopleId from people group by peopleId
having count
(peopleId) > 1)
2¡¢É¾³ý±íÖжàÓàµÄÖظ´¼Ç¼£¬Öظ´¼Ç¼ÊǸù¾Ýµ¥¸ö×ֶΣ¨p ......
groupadd mysql
н¨Ò»¸öÃûΪmysqlµÄÓû§×é
useradd -g mysql mysql
ÔÚmysqlÓû§×éÏÂн¨Ò»¸öÃûΪmysqlµÄÓû§
gunzip ½âѹÏÂÔص½µÄ.gzÎļþ
cd mysql-VERSION
½øÈë½âѹºóµÄĿ¼
CFLAGS="-O3 -mcpu=pentium4" CXX=gcc CXXFLAGS="-O3 -march=pentium4 -felide-constructors -fno-exceptions -fno-rtti" ./configu ......
½ñÌìÔÚÐÞ¸ÄÒÔÇ°¿ª·¢µÄÒ»¸öÍøÕ¾µÄʱºòÓöµ½Ò»¸öÎÊÌ⣬ÒòΪ¹¦ÄܵÄÐèÒª£¬ÒÔÇ°µÄÒ»¸öÊý×ÖÀàÐÍ×ֶθıäΪÎı¾×ֶΣ¬ÒòΪÕâ¸ö×Ö¶ÎÐèÒª°üº¬¶à¸öÀà±ðµÄID£¬ÒÔÇ°Õâ¸ö×Ö¶ÎÖ»¶ÔÓ¦Ò»¸öIDµÄ¡£
ÍøÕ¾ÊÇASP VBÓïÑԵģ¬Êý¾Ý¿âʹÓõÄÊÇAccess
ÐÞ¸ÄÊý¾ÝÀàÐÍÖ®ºóǰ̨µÄ²éѯ´úÂë¾Í²»ÄÜʹÓÃÖîÈçxID=1ÕâÖÖÌõ¼þÁË¡£ÓÉÓÚÏÖÔÚ¸Ã×ֶαäΪÎı¾ÀàÐ ......