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

mysql Ëæ»ú»ñÈ¡¼Ç¼ order by rand ÓÅ»¯

Èç¹ûÒªËæ»ú»ñÈ¡¼Ç¼Êý£¬ÔÚmysqlÀï×î¼òµ¥µÄ·½·¨¿Ï¶¨ÊÇorder
by
rand
()ÁË£¬µ«ÊÇÕâÖÖ·½·¨Ö»ÄÜÔÚ±í¼Ç¼¼«ÉÙµÄÇé¿öϲÅÄÜʹÓá£Ö÷ÒªÊÇÒòΪorder
by
rand
()µ¼ÖÂÁËusing filesort.Õâ¸öʱºò²éѯÀàÐÍ»á±ä³Éall£¬Ë÷Òý»áʧЧ¡£Ö»Ðè¼òµ¥µÄ±äͨÏ£¬Íê³É¿ÉÒÔ×öµ½Í¬ÑùµÄЧ¹û¡£
¸ù¾Ý¼Ç¼µÄÀàÐÍ£¬·ÖÀàÁ¬ÐøºÍ·ÇÁ¬ÐøÁ½ÖÖ¡£
Á¬ÐøÖ¸¼Ç¼ÊÇÁ¬Ðø´æ·ÅµÄ£¬²¢ÇÒÓÐ×ֶοÉÒÔÖ¤Ã÷¼Ç¼ÊÇÁ¬ÐøµÄ£¬ÀýÈç×ÔÔöid¡£
·ÇÁ¬ÐøÊÇÖ¸¼Ç¼ÊÇËæ»ú´æ·ÅµÄ£¬ÀýÈçÓÐÌõ¼þµÄ²éѯ£¬½á¹û¿Ï¶¨²»ÊÇÁ¬ÐøµÄ¡£
Ò»¡¢Á¬Ðø¼Ç¼ÓÅ»¯
Ïȵõ½±íµÄ×î´óidºÍ×îСid¡£select max(id),min(id) from table
1.ÔÚ³ÌÐòÀïËæ»úÒ»¸öÔÚ×î´óidºÍ×îСidµÄÖмäÊý£¬²éѯµÄʱºò´óÓÚÕâ¸öËæ»úÊýµÄ¾ÍÊÇËæ»ú¼Ç¼ÁË¡£
Sql´úÂë
select
 * 
from
 
table
 
where
 id > ÖмäÊý limit length;  
select * from table where id > ÖмäÊý limit length;
ȱµã£ºÈç¹ûÖмäÊýºÜ´óµÄ»°£¬»ñÈ¡²»ÁËÐèÒªµÄ¼Ç¼Êý£¬Ëæ»úÐÔ²»Ç¿
2.ÔÚ³ÌÐòÀïËæ»ún¸ö×î´óidºÍ×îСidµÄÖмäÊý£¬²éѯµÄʱºòÓÃin»ñµÃÕ⼸¸öÖмäÊýµÄ¼Ç¼
Sql´úÂë
select
 * 
from
 
table
 
where
 id 
in
 (ÖмäÊý1, ÖмäÊý2,ÖмäÊý3)  
select * from table where id in (ÖмäÊý1, ÖмäÊý2,ÖмäÊý3)
ÐèҪעÒâµÄÊÇ£¬Èç¹ûÄãÒª»ñÈ¡5Ìõ¼Ç¼£¬Äǽ¨ÒéËæ»ú10¸öÊý¡£
ȱµã£ºÐÔÄܲ»ÈçµÚ1ÖÖ·½·¨£¬µ«ÊÇËæ»úÐÔ¸üÇ¿
¶þ¡¢·ÇÁ¬Ðø¼Ç¼ÓÅ»¯
Æäʵ·ÇÁ¬Ðø¼Ç¼µÄ·½·¨Ò»Ñù¿ÉÒÔÓ¦ÓÃÔÚÁ¬Ðø¼Ç¼ÖС£
Ê×ÏÈ»ñµÃ¼Ç¼µÄ×ÜÊý£¬ÀýÈ磺select count(*) from table where groupid = 1;
È»ºóÔÚ³ÌÐòÀïËæ»ún¸öСÓڼǼ×ÜÊýµÄÖмäÊý£¬Ö®ºóͨ¹ýÑ­»·
Sql´úÂë
select
 * 
from
 
table
 
where
 groupid = 1 limit ÖмäÊý,1  
select * from table where groupid = 1 limit ÖмäÊý,1
À´»ñµÃ¼Ç¼¡£
¹ØÓÚÓÅ»¯Ñ­»·sql¿ÉÒÔ²ÉÓÃprepare»òÕßunion allÀ´ÓÅ»¯Ñ­»·Ö´ÐÐ
¹ØÓÚµÚÈýÖÖ·½·¨ÀûÓÃlimit´ïµ½Ëæ»úµÄЧ¹û£¬ÎÒÄÃÁ˵ãÊý¾Ý²âÊÔ¡£
×ܼǼ£º175,410   Ìõ¼þ¼Ç¼£º20,946
order
by
rand
Sql´úÂë
SELECT
 * 
from
 Member 
WHERE
 Country = 
"HK"
 
ORDER
 
BY
 RAND
() limit 30  
SELECT


Ïà¹ØÎĵµ£º

²é¿´ MySql ×Ö·û¼¯

MySQL ÂÒÂëµÄ¸ùÔ´ÊÇµÄ MySQL ×Ö·û¼¯ÉèÖò»µ±µÄÎÊÌ⣬±¾ÎÄ»ã×ÜÁËÓйز鿴 MySQL ×Ö·û¼¯µÄÃüÁî¡£°üÀ¨²é¿´ MySQL Êý¾Ý¿â·þÎñÆ÷×Ö·û¼¯¡¢²é¿´ MySQL Êý¾Ý¿â×Ö·û¼¯£¬ÒÔ¼°Êý¾Ý±íºÍ×ֶεÄ×Ö·û¼¯¡¢µ±Ç°°²×°µÄ MySQL ËùÖ§³ÖµÄ×Ö·û¼¯µÈ¡£
Ò»¡¢²é¿´ MySQL Êý¾Ý¿â·þÎñÆ÷ºÍÊý¾Ý¿â×Ö·û¼¯¡£
mysql> show variables like '%char%';
+-- ......

Mysql Explain Ïê½â[Ç¿ÁÒÍƼö]

Mysql Explain Ïê½â
Ò».Óï·¨
explain < table_name >
ÀýÈç: explain select * from t3 where id=3952602;
¶þ.explainÊä³ö½âÊÍ
+----+-------------+-------+-------+-------------------+---------+---------+-------+------+-------+
| id | select_type | table | type  | possible_keys  &nb ......

ubuntu9.04Öа²×°ÅäÖÃphp5 + MySql + Apache

   - -!   Õæ²»ÈÝÒ×°¡£¬ÅªÁËÒ»Ì죬ÖÕÓڸ㶨ÁË£¡
  ÔÚubuntu9.04Ï°²×°£¬Ê×ÏÈҪ׼±¸µÄ¶«Î÷ºÜ¶à£¬´ó²¿·ÖÊÇÓÃÀ´Ö§³ÖphpµÄ¿â£¬·Ï»°²»¶à˵£¬Ð´Õâ¸öÒ²ÊÇΪÁ˱ãÓÚÎÒÒÔºó²é¿´Ó㬼ÇÒä²»ÐУ¬¿È¡£¡£ÓÐÐèÒªµÄÅóÓÑÒ²¿ÉÒÔÀ´È¥Óá£
  ÔÚubuntuÉÏ°²×°£¬ÓÐÒ»¸öºÃ´¦¾ÍÊÇÓÐÐÂÁ¢µÃÕâ¸öÈí¼þ£¬Ê×ÏÈÏÈ°²×°mysql£¬ ......

Jsp Á¬½Ó mySQL¡¢Oracle Êý¾Ý¿â±¸Íü

Jsp Á¬½Ó mySQL¡¢Oracle Êý¾Ý¿â±¸Íü
2009-12-15 16:47
Jsp »·¾³Ä¿Ç°×îÁ÷ÐеÄÊÇ Tomcat5.0¡£Tomcat5.0 ×Ô¼º°üº¬Ò»¸ö Web ·þÎñÆ÷£¬Èç¹ûÊDzâÊÔ£¬¾Íû±ØÒª°Ñ Tomcat Óë IIS »ò Apache ¼¯³ÉÆðÀ´¡£ÔÚ Tomcat ×Ô´øµÄ Web ·þÎñÆ÷Ï¿ÉÒÔ½øÐÐ Jsp ²âÊÔ¡£
    °²×° Tomcat5.0 Ç°ÐèÒª°²×° JDK(Èç¹ûÊÇ Windows server ......

linuxÏ mysql Íü¼ÇrootÓû§ÃÜÂë½â¾ö°ì·¨

linuxÏÂÍü¼ÇÁËmysqlµÄrootÓû§ÃÜÂë½â¾ö°ì·¨£º
¡¡¡¡Ò»¡¢ÒÔϵͳµÄrootÓû§£¨Ê²Ã´£¬ÄãµÄϵͳµÄrootÓû§ÃÜÂëÒ²ÍüÁË¡£ÄÇÖ»ºÃ¿´ÎÒÁíÍâһƪlinuxÏÂÍü¼ÇrootÓû§µÄ½â¾ö°ì·¨ÁËÏȽâ¾öÕâ¸öÎÊÌ⣩µÇ½ϵͳ£¬½øÈëÖÕ¶Ë
¡¡¡¡[root@localhost /]#
¡¡¡¡¶þ¡¢É±µômysql½ø³Ì
¡¡¡¡·½·¨1¡¢[root@localhost /]#killall mysqld
¡¡¡¡·½·¨2¡ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ