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

MySQLÐÔÄÜÓÅ»¯

×÷Õߣºandyao
Ô­ÎÄlink: http://andyao.javaeye.com/admin/show/144033
תÔØÇëÁôÃû
1. ¼ò½é
ÔÚWebÓ¦ÓóÌÐòÌåϵ¼Ü¹¹ÖУ¬Êý¾Ý³Ö¾Ã²ã£¨Í¨³£ÊÇÒ»¸ö¹ØϵÊý¾Ý¿â£©ÊǹؼüµÄºËÐIJ¿·Ö£¬Ëü¶ÔϵͳµÄÐÔÄÜÓзdz£ÖØÒªµÄÓ°Ïì¡£MySQLÊÇĿǰʹÓÃ×î¶àµÄ¿ªÔ´Êý¾Ý¿â£¬µ«ÊÇMySQLÊý¾Ý¿âµÄĬÈÏÉèÖÃÐÔÄܷdz£µÄ²î£¬½ö½öÊÇÒ»¸öÍæ¾ßÊý¾Ý¿â¡£Òò´ËÔÚ²úÆ·ÖÐʹÓÃMySQLÊý¾Ý¿â±ØÐë½øÐбØÒªµÄÓÅ»¯¡£
ÓÅ»¯ÊÇÒ»¸ö¸´ÔÓµÄÈÎÎñ£¬±¾ÎÄÃèÊöMySQLÏà¹ØµÄÊý¾Ý¿âÉè¼ÆºÍ²éѯÓÅ»¯£¬·þÎñÆ÷¶ËÓÅ»¯£¬´æ´¢ÒýÇæÓÅ»¯¡£
2. Êý¾Ý¿âÉè¼ÆºÍ²éѯÓÅ»¯
ÔÚMySQL ServerÐÔÄܵ÷ÓÅÖУ¬Ê×ÏÈÒª¿¼ÂǵľÍÊÇDatabase SchemaÉè¼Æ£¬ÕâÒ»µãÊǷdz£ÖØÒªµÄ¡£Ò»¸öÔã¸âµÄSchemaÉè¼Æ¼´Ê¹ÔÚÐÔÄܵ÷ÓŵÄMySQL ServerÉÏÔËÐУ¬Ò²»á±íÏÖ³öºÜ²îµÄÐÔÄÜ£»ºÍSchemaÏàËÆ£¬²éѯÓï¾äµÄÉè¼ÆÒ²»áÓ°ÏìMySQLµÄÐÔÄÜ£¬Ó¦¸Ã±ÜÃâд³öµÍЧµÄSQL²éѯ¡£ÕâÒ»½Ú½«ÏêϸÌÖÂÛÕâÁ½·½ÃæµÄÓÅ»¯¡£
2.1 Schema Design
SchemaµÄÓÅ»¯È¡¾öÓÚ½«ÒªÔËÐÐʲôÑùµÄquery£¬²»Í¬µÄquery»áÓв»Í¬µÄSchemaÓÅ»¯·½°¸¡£2.2½Ú½«½éÉÜQuery DesignµÄÓÅ»¯¡£SchemaÉè¼ÆͬÑùÊܵ½Ô¤ÆÚÊý¾Ý¼¯´óСµÄÓ°Ïì¡£SchemaÉè¼ÆʱÖ÷Òª¿¼ÂÇ£º±ê×¼»¯£¬Êý¾ÝÀàÐÍ£¬Ë÷Òý¡£
2.1.1 ±ê×¼»¯
±ê×¼»¯ÊÇÔÚÊý¾Ý¿âÖÐ×éÖ¯Êý¾ÝµÄ¹ý³Ì¡£ÆäÖаüÀ¨£¬¸ù¾ÝÉè¼Æ¹æÔò´´½¨±í²¢ÔÚÕâЩ±í¼ä½¨Á¢¹Øϵ£»Í¨¹ýÈ¡ÏûÈßÓà¶ÈÓë²»Ò»ÖÂÏà¹ØÐÔ£¬¸ÃÉè¼Æ¹æÔò¿ÉÒÔͬʱ±£»¤Êý¾Ý²¢Ìá¸ßÊý¾ÝµÄÁé»îÐÔ¡£Í¨³£Êý¾Ý¿â±ê×¼»¯ÊÇÈÃÊý¾Ý¿âÉè¼Æ·ûºÏijһ¼¶±ðµÄ·¶Ê½£¬Í¨³£Âú×ãµÚÈý·¶Ê½¼´¿É¡£Ò²ÓеÚËÄ·¶Ê½£¨Ò²³ÆΪ Boyce Codd·¶Ê½£¬BCNF)£©ÓëµÚÎ巶ʽ´æÔÚ£¬µ«ÊÇÔÚʵ¼ÊÉè¼ÆÖкÜÉÙ¿¼ÂÇ¡£ºöÊÓÕâЩ¹æÔò¿ÉÄÜʹµÃÊý¾Ý¿âµÄÉè¼Æ²»Ì«ÍêÃÀ£¬µ«Õâ²»Ó¦Ó°Ï칦ÄÜ¡£
±ê×¼»¯µÄÌص㣺
1) ËùÓеē¶ÔÏ󔶼ÔÚËü×Ô¼ºµÄtableÖУ¬Ã»ÓÐÈßÓà¡£
2) Êý¾Ý¿âͨ³£ÓÉE-RͼÉú³É¡£
3) ¼ò½à£¬¸üÐÂÊôÐÔͨ³£Ö»ÐèÒª¸üкÜÉٵļǼ¡£
4) Join²Ù×÷±È½ÏºÄʱ¡£
5) Select£¬sortÓÅ»¯´ëÊ©±È½ÏÉÙ¡£
6) ÊÊÓÃÓÚOLTPÓ¦Óá£
·Ç±ê×¼»¯µÄÌص㣺
1) ÔÚÒ»ÕűíÖд洢ºÜ¶àÊý¾Ý£¬Êý¾ÝÈßÓà¡£
2) ¸üÐÂÊý¾Ý¿ªÏúºÜ´ó£¬¸üÐÂÒ»¸öÊôÐÔ¿ÉÄÜ»á¸üкܶà±í£¬ºÜ¶à¼Ç¼¡£
3) ÔÚɾ³ýÊý¾ÝÊÇÓпÉÄܶªÊ§Êý¾Ý¡£
4) Select£¬orderÓкܶàÓÅ»¯µÄÑ¡Ôñ¡£
5) ÊÊÓÃÓÚDSSÓ¦Óá£
±ê×¼»¯ºÍ·Ç±ê×¼»¯¶¼Óи÷×ÔµÄÓÅȱµã£¬Í¨³£ÔÚÒ»¸öÊý¾Ý¿âÉè¼ÆÖпÉÒÔ»ìºÏʹÓã¬Ò»²¿·Ö±í¸ñ±ê×¼»¯£¬Ò»²¿·Ö±í¸ñ±£ÁôһЩÈßÓàÊý¾Ý£º
1) ¶ÔOLTPʹÓñê×¼»¯£¬¶ÔDSSʹÓ÷DZê×¼»¯
2) ʹÓÃÎﻯÊÓͼ¡£MySQL²»Ö±½ÓÖ§³Ö¸ÃÊý¾Ý¿âÌØÐÔ£¬µ«ÊÇ¿ÉÒÔÓÃMyISAM


Ïà¹ØÎĵµ£º

¸ßÐÔÄÜMySqlѧϰ±Ê¼Ç(Ò»)

¸ßÐÔÄÜMySqlѧϰ±Ê¼Ç
1.Õë¶ÔÓ¦Óý¨Á¢×Ô¼ºµÄË÷Òý
URL²éÕÒÀý×Ó
    select * from tUrl where url='http://www.163.com';
ÒÔurl£¨×Ö·û´®£©×÷ÐÐΪË÷Òý»áʹµÃ×÷ΪË÷Òý½á¹¹µÄB-Tree±ä´ó£¬¿ÉÒÔÒƳýurlÁÐÉϵÄË÷Òý£¬²¢Ìí¼ÓÒ»¸öurl_crcË÷ÒýÁУ¬
ÏȽ¨Á¢±í£º
create tables tUrl(
     ......

MySQLÊý¾Ý¿âÉè¼ÆÔ­Ôò

ת×Ô http://www.supidea.com/post/mysql_design_database.aspx
MySQLÊý¾Ý¿âÉè¼ÆÔ­Ôò
MySQL¶ÔÓÚ³ÉΪһ¸ö·Ç³£¿ìËÙµÄÊý¾Ý¿â·þÎñÆ÷ÓÐ×ŵ±Ö®ÎÞÀ¢µÄÃûÉù£¬ËüÒ²·Ç³£ÈÝÒ×ÉèÖúÍʹÓá£Ëæ×ÅËü×÷ΪÍøÕ¾ºó¶ËÊý¾Ý¿âµÃÉùÍûÈÕÔö£¬ÆäЧ¹ûÔÚÈ¥Ä꿪ʼÓÐÃ÷ ÏÔÌá¸ß¡£µ«ÊǺܶàMySQLÓû§¸ü¶àµØÖªµÀÈçºÎ´´½¨Ò»¸öÊý¾Ý¿â²¢±àд¶ÔËüµÄ²éѯ¡£¾ÍÏñ³ÉÇ ......

PHPÓëMySQL¿ª·¢ÖеÄ×Ö·û±àÂëÎÊÌâ

Ò»£®¹ØÓÚMySQLÊý¾Ý¿â·þÎñÆ÷
MySQL·þÎñÆ÷µÄĬÈϱàÂëÊÇLatin1£¬²»Ö§³ÖÖÐÎÄ£¬ÄÇôÈçºÎÐÞ¸ÄMySQLµÄĬÈϱàÂëÄØ£¬ÏÂÃæÒÔUTF-8ΪÀýÀ´ËµÃ÷¡£
1¡¢ÖÐÖ¹MySQL·þÎñ£¨bin/mysqladmin -u root shutdown£©
2¡¢ÔÚ/etc/ÏÂÕÒµ½my.cnf£¬Èç¹ûûÓоͰÑMySQLµÄ°²×°Ä¿Â¼ÏµÄsupport-filesĿ¼ÏµÄmy-medium.cnf¸´ÖƵ½/etc/ϲ¢¸ÄÃûΪmy.cnf¼´¿É ......

mysql alter Óï¾äÓ÷¨,Ìí¼Ó¡¢Ð޸ġ¢É¾³ý×ֶεÈ

http://www.blogjava.net/Alpha/archive/2007/07/23/131912.html
//Ö÷¼ü549830479
alter table tabelname add new_field_id int(5) unsigned default 0 not null auto_increment ,add primary key (new_field_id);
//Ôö¼ÓÒ»¸öÐÂÁÐ549830479
alter table t2 add d timestamp;
alter table infos add ex tinyint n ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ