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

MySQL µÄǶÌײéѯ

×î½üÔÚMySQLÉÏ×öÁ˵㹤×÷£¬·¢ÏֺܶàÈ˶¼ÔÚѯÎÊMySQLǶÌײéѯµÄÎÊÌ⣬Ðí¶àÈ˶¼¾õµÃMySQL²»Ö§³ÖǶÌײéѯ£¬ÆäʵMySQl´Ó4.11°æºóÒѾ­ÍêÈ«Ö§³ÖǶÌײéѯÁË£¬ÄÇôÏÂÃæÎÒ¾ÙЩ¼òµ¥µÄǶÌײéѯµÄÀý×Ó°É£¨Ô´³ÌÐòÀ´×ÔMySQL User Manual£©£º
1. SELECTÓï¾äµÄ×Ó²éѯ:
Óï·¨: SELECT ... from (subquery) AS name ...
ÏÈ´´½¨Ò»¸ö±í:
CREATE TABLE t1 (s1 INT, s2 CHAR(5), s3 FLOAT);
INSERT INTO t1 VALUES (1,'1',1.0);
INSERT INTO t1 VALUES (2,'2',2.0);
ÎÒÃǾͿÉÒÔ½øÐÐÒÔϵÄǶÌײéѯÁË:
SELECT sb1,sb2,sb3
from (SELECT s1 AS sb1, s2 AS sb2, s3*2 AS sb3 from t1) AS sb
WHERE sb1 > 1;
½á¹ûÊÇ£º 2, '2', 4.0.
ÎÒÃÇÖªµÀÏÂÃæÓï¾äÊDz»»áµÃµ½ÕýÈ·½á¹ûµÄ£¬ÒòΪ¶Ô¾­¹ýGroup byÅÅÐòµÄ¼¯ºÏ½øÐÐÇó¾ùÖµÊDz»Äܵõ½ÕýÈ·´ð°¸µÄ£º
SELECT AVG(SUM(column1)) from t1 GROUP BY column1
ËùÒÔÎÒÃÇ¿ÉÒÔͨ¹ýÏÂÃæµÄǶÌײéѯʵÏÖͬÑùµÄЧ¹û£º
SELECT AVG(sum_column1)
from (SELECT SUM(column1) AS sum_column1
from t1 GROUP BY column1) AS t1;
2.ÐеÄ×Ó²éѯ£¨Row Subquery£©£º
¿´ÏÂÃæµÄÀý×Ó£º
SELECT * from t1 WHERE ROW(1,2) = (SELECT column1, column2 from t2);
Õâ¸ö²éѯÊÇ·µ»Øcolumn1µÈÓÚcolumn2µÄ½á¹ûÐС£Rowº¯ÊýÖеÄ1ºÍ2Ï൱ÓÚ¹¹Ôì²ÎÊý¡£Ïë±ØBlogjavaÉϵÄͬ־¶ÔÕâЩӦ¸Ã±È½ÏÇå³þ£¬Ò²²»È¥Ïêϸ½éÉÜÁË¡£
3.ʹÓÃExistºÍNot Exist²ÎÊý
ÕâÀïµÄExistºÍNot ExistÓÃ;¼°Ó÷¨ºÍÔÚÆäËûûÓÐʲô´óµÄÇø±ð,ÎҾͼòµ¥¾Ù¼¸¸ö·¶ÀýºÃÁË:
·¶ÀýÒ»: SELECT DISTINCT store_type from Stores
WHERE EXISTS (SELECT * from Cities_Stores
WHERE Cities_Stores.store_type = Stores.store_type);
·¶Àý¶þ: SELECT DISTINCT store_type from Stores
WHERE NOT EXISTS (SELECT * from Cities_Stores
WHERE Cities_Stores.store_type = Stores.store_type);
·¶ÀýÈý: Õâ¸öÀý×ÓÖÐǶÌ×ʹÓÃÁËNot ExistÓï·¨£¬ÉÔ΢עÒâһϣº
SELECT DISTINCT store_type from Stores S1
WHERE NOT EXISTS (
SELECT * from Cities WHERE NOT EXISTS (
SELECT * from Cities_Stores


Ïà¹ØÎĵµ£º

Nginx + PHP + Mysql (php frm 방식)


Nginx + PHP + Mysql (php-frm 방식)

 글쓴이 :
최고관리자


조회 : 2,884  

......

»ùÓÚSphinx+MySQLÈ«ÎļìË÷¼Ü¹¹Éè¼Æ

Ç°ÑÔ£º
±¾ÎIJûÊöµÄÊÇÒ»¿î¾­¹ýÉú²ú»·¾³¼ìÑéµÄǧÍò¼¶Êý¾ÝÈ«ÎļìË÷£¨ËÑË÷ÒýÇ棩¼Ü¹¹¡£±¾ÎÄÖ»ÁгöÇ°¼¸ÕµÄÄÚÈݽÚÑ¡£¬²»ÌṩȫÎÄÄÚÈÝ¡£
ÔÚDELL PowerEdge 6850·þÎñÆ÷£¨ËÄ¿Å64 λInter Xeon MP 7110N´¦ÀíÆ÷ / 8GBÄڴ棩¡¢RedHat AS4 Linux²Ù×÷ϵͳ¡¢MySQL 5.1.26¡¢MyISAM´æ´¢ÒýÇæ¡¢key_buffer=1024M»·¾³ÏÂʵ²â£¬µ¥±í1000ÍòÌõ¼Ç ......

ÈçºÎÌá¸ßMySQLÐÔÄÜ

Ò»¡¢ÎÊÌâµÄÌá³ö

¡¡¡¡ÔÚÓ¦ÓÃϵͳ¿ª·¢³õÆÚ£¬ÓÉÓÚ¿ª·¢Êý¾Ý¿âÊý¾Ý±È½ÏÉÙ£¬¶ÔÓÚ²éѯSQLÓï¾ä£¬¸´ÔÓÊÓͼµÄµÄ±àдµÈÌå»á²»³öSQLÓï¾ä¸÷ÖÖд·¨µÄÐÔÄÜÓÅÁÓ£¬µ«ÊÇÈç¹û½«Ó¦ÓÃϵͳ
Ìύʵ¼ÊÓ¦Óúó£¬Ëæ×ÅÊý¾Ý¿âÖÐÊý¾ÝµÄÔö¼Ó£¬ÏµÍ³µÄÏìÓ¦ËٶȾͳÉΪĿǰϵͳÐèÒª½â¾öµÄ×îÖ÷ÒªµÄÎÊÌâÖ®Ò»¡£ÏµÍ³ÓÅ»¯ÖÐÒ»¸öºÜÖØÒªµÄ·½Ãæ¾ÍÊÇSQLÓï¾äµÄÓÅ»¯¡£ ......

mysql 4.1ÒÔÉÏ°æ±¾ÖÐÎÄÂÒÂë½â¾ö·½·¨¼¯½õ

mysql 4.1µÄ¸Ä±äÔì³ÉµÄÂÒÂë½â¾ö·½·¨
µÚÒ»¸ö·½·¨£º
MySQL 4.1 ÖÐÎÄÂÒÂëµÄÎÊÌâ
×î½üÒª½« MySQL 4.0 Éý¼¶µ½ MySQL 4.1 £¬·¢ÏÖÁËÖÐÎÄÂÒÂëµÄÎÊÌ⣬ϣÍûÒÔϼû½â¶Ô´ó¼ÒÓÐÓá£
1. MySQL 4.1 ÔÚÎÄ×ÖÉÏÓкܴó¸Ä½ø£¬ËüÓÐÁË Character Set Óë Collation µÄ¿®Äî¡£
2. ÔÚ MySQL 4.0 £¬Ò»°ãµÄ³Ìʽ¶¼»á½«ÎÄ×ÖÒÔÀ­¶¡ÎÄ ( latin)  ......

ÄãÓ¦¸ÃÖªµÀµÄ10¸öMySQL¿Í»§Æô¶¯Ñ¡Ïî

´ó²¿·Ö·þÎñÆ÷¹ÜÀíÔ±ÖªµÀMySQLÊý¾Ý¿â¹ÜÀíϵͳ£¨RDBMS£©ÊǸ߶ÈÁé»îµÄÈí¼þ¿é£¬´øÓз¶Î§¹ãÀ«µÄÆô¶¯Ñ¡Ï¿ÉÒÔÓÃÀ´ÐÞ¸ÄÏà¹ØÐÐΪ¡£È»¶ø£¬´ó²¿·ÖÈËÈ´²»
Çå³þ£¬±ê×¼MySQL¿Í»§¶Ë´øÓÐͬµÈ´óÁ¿µÄÆô¶¯Ñ¡ÏÆäÖÐһЩÔÚÈÕ³£MySQL½»»¥×÷ÓÃÖм«ÎªÓÐÓá£ÕâЩѡÏî±¾Éí²»ÊÇ
“ÃØÃÜ”£¬¶øËüÃÇÖкܶàδ±»Ê¹Óã¬ÉõÖÁÆäÖÐһЩ¿ÉÒÔÏÔÖø ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ