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

whereÌõ¼þ¶Ômysql¶àÁÐË÷ÒýµÄʹÓÃ

      MySQLÊÖ²áÖп´µ½µÄ£¬¼Ç¼Ï¡£
      MySQL¿ÉÒÔΪ¶à¸öÁд´½¨Ë÷Òý¡£Ò»¸öË÷Òý¿ÉÒÔ°üÀ¨15¸öÁС£¶ÔÓÚijЩÁÐÀàÐÍ£¬¿ÉÒÔË÷ÒýÁеÄǰ׺(²Î¼û7.4.3½Ú£¬“ÁÐË÷Òý”)¡£
¶àÁÐË÷Òý¿ÉÒÔÊÓΪ°üº¬Í¨¹ýÁ¬½ÓË÷ÒýÁеÄÖµ¶ø´´½¨µÄÖµµÄÅÅÐòµÄÊý×é¡£
MySQL°´ÕâÑùµÄ·½Ê½Ê¹ÓöàÁÐË÷Òý£ºµ±ÄãÔÚWHERE×Ó¾äÖÐΪË÷ÒýµÄµÚ1¸öÁÐÖ¸¶¨ÒÑÖªµÄÊýÁ¿Ê±£¬²éѯºÜ¿ì£¬¼´Ê¹ÄãûÓÐÖ¸¶¨ÆäËüÁеÄÖµ¡£
¼Ù¶¨±í¾ßÓÐÏÂÃæµÄ½á¹¹£º
CREATE TABLE test (
    id INT NOT NULL,
    last_name CHAR(30) NOT NULL,
    first_name CHAR(30) NOT NULL,
    PRIMARY KEY (id),
    INDEX name (last_name,first_name)
);
      nameË÷ÒýÊÇÒ»¸ö¶Ôlast_nameºÍfirst_nameµÄË÷Òý¡£Ë÷Òý¿ÉÒÔÓÃÓÚΪlast_name£¬»òÕßΪlast_nameºÍfirst_nameÔÚÒÑÖª·¶Î§ÄÚÖ¸¶¨ÖµµÄ²éѯ¡£Òò´Ë£¬nameË÷ÒýÓÃÓÚÏÂÃæµÄ²éѯ£º
SELECT * from test WHERE last_name='Widenius';
 
SELECT * from test
    WHERE last_name='Widenius' AND first_name='Michael';
 
SELECT * from test
    WHERE last_name='Widenius'
    AND (first_name='Michael' OR first_name='Monty');
 
SELECT * from test
    WHERE last_name='Widenius'
    AND first_name >='M' AND first_name < 'N';
È»¶ø£¬nameË÷Òý²»ÓÃÓÚÏÂÃæµÄ²éѯ£º
SELECT * from test WHERE first_name='Michael';
 
SELECT * from test
    WHERE last_name='Widenius' OR first_name='Michael';


Ïà¹ØÎĵµ£º

mysqlʹÓÃС¼Ç

       ×î½üÓÃmysqlдÁ˼¸¸ö¸´ÔÓµÄÓï¾ä£¬¸Ð¾õÔÚ¹ØÏµºÜ¸´ÔÓµÄʱºòÏÈÀíÇå¹ØÏµÔÙÑ¡ÔñÓõIJéѯ·½·¨ÊǺÜÖØÒªµÄ£¬ÒòΪͬһ¸öÐèÇó¿ÉÄÜÓò»Í¬µÄ·½·¨À´²é³öÀ´£¬µ«ÊǸ´ÔÓ¶È£¬ÐÔÄܶ¼²»Ò»Ñù¡£
      ÏÂÃæËµÒ»ÏÂÄÜʵÏÖ¸´ÔÓ²éѯµÄһЩһ°ã·½·¨£º
Ò».withÓï·¨£¨Ê×ÏÈ˵Ã÷£¬ºÃÏñMysql²»Ö§³ÖÕâ¸öÓï ......

mysql errno: 150 ´íÎó Íâ¼ü

ERROR 1005 (HY000): Can't create table '  ****.frm' (errno: 150)
ÎÒÊÇ´ÓÒÔϼ¸¸ö·½Ãæ½â¾öÁË´ËÎÊÌ⣺
1¡¢È·±£²ÎÕյıíºÍ×Ö¶ÎÊÇ´æÔڵģ»
2¡¢×é³ÉÍâ¼üµÄ×Ö¶ÎÒªÇó±»Ë÷Òý(Ö÷ÒªÊÇÍâ¼üÄǸö×Ö¶ÎÒªÇóÔÚÆäËû±íÖÐÊÇÖ÷¼ü)£»
3¡¢Íâ¼ü¹ØÁªµÄÁ½±í»ò¶à±íÒªÇó¶¼ÊÇINNODBÀàÐÍµÄ±í£»
4¡¢×Ö¶ÎÀàÐÍ£¨ËµÃ÷£©ÒªÒ»Ñù`itemId` varchar( ......

MySQL .frm .myd .myi Îļþ ¼°Êý¾Ý¿â±¾µØÒÆÖ²

     ½ñÌìÔÚʵ¼Ê¿ª·¢ÖжÔÓÚMySQLÊý¾Ý¿â½øÐÐÒÆÖ²·¢ÉúµÄÎÊÌâÀ´ËµÏÂ. ¿ªÊ¼°Ñ±¾µØdataÖеÄÊý¾Ý¿âÎļþ¿½±´µ½Áíһ̨»ú×ÓÉÏTest, Ö´ÐÐshow tables ; ¿ÉÒÔ¿´µ½Êý¾Ý¿â±í,µ«ÊÇ¶Ô±í½øÐÐÈκβÙ×÷¶¼±¨´í: ±í²»´æÔÚ , Ô­ÒÔΪMysqlµÄÊý¾Ý¿âÎļþ(.frm)Copy->stickµ½±¾µØ°²×°MySQLDBĿ¼µÄdataÎļþ¼ÐϾͿÉÒÔ.ÊÂʵ²»Ê ......

¿ªÊ¼ÊÕ¼¯mysqlµÄ¸÷ÖÖÃüÁî

  ÕâÀïÊÕ¼¯¸÷ÖÖMysqlµÄ»ù´¡ÖªÊ¶,ΪÁËijЩ³¡ºÏµÄÐèÒª,»¹ÊÇÉáÆúnavicatÖ®ÀàµÄ¹¤¾ß¹Ô¹ÔÓÃÃüÁîÐаɠ  
£¨×¢ÒâÓеÄÃüÁîÐèÒª·ÖºÅÓеIJ»ÐèÒª)
Ò».»ù±¾²Ù×÷
  1.µÇ¼
     mysql -u Óû§Ãû -pÃÜÂë Êý¾Ý¿âÃû
         ÕâÀïÐè ......

MySQLÖÐUNION

ÔÚÊý¾Ý¿âÖУ¬UNIONºÍUNION ALL¹Ø¼ü×Ö¶¼Êǽ«Á½¸ö½á¹û¼¯ºÏ²¢ÎªÒ»¸ö£¬µ«ÕâÁ½Õß´ÓʹÓúÍЧÂÊÉÏÀ´Ëµ¶¼ÓÐËù²»Í¬¡£
MySQLÖеÄUNION
UNIONÔÚ½øÐбíÁ´½Óºó»áɸѡµôÖØ¸´µÄ¼Ç¼£¬ËùÒÔÔÚ±íÁ´½Óºó»á¶ÔËù²úÉúµÄ½á¹û¼¯½øÐÐÅÅÐòÔËË㣬ɾ³ýÖØ¸´µÄ¼Ç¼ÔÙ·µ»Ø½á¹û¡£Êµ¼Ê´ó²¿·ÖÓ¦ÓÃÖÐÊDz»»á²úÉúÖØ¸´µÄ¼Ç¼£¬×î³£¼ûµÄÊǹý³Ì±íÓëÀúÊ·±íUNION¡£Èç ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ