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

MysqlÖÐlimitµÄÓ÷¨Ïê½â


MysqlÖÐlimitµÄÓ÷¨£ºÔÚÎÒÃÇʹÓòéѯÓï¾äµÄʱºò£¬¾­³£Òª·µ»ØÇ°¼¸Ìõ»òÕßÖмäij¼¸ÐÐÊý¾Ý£¬Õâ¸öʱºòÔõô°ìÄØ£¿²»Óõ£ÐÄ£¬mysqlÒѾ­ÎªÎÒÃÇÌṩÁËÕâÑùÒ»¸ö¹¦ÄÜ¡£
SELECT * from table   LIMIT [offset,] rows | rows OFFSET offset
LIMIT ×Ó¾ä¿ÉÒÔ±»ÓÃÓÚÇ¿ÖÆ SELECT Óï¾ä·µ»ØÖ¸¶¨µÄ¼Ç¼Êý¡£LIMIT ½ÓÊÜÒ»¸ö»òÁ½¸öÊý×Ö²ÎÊý¡£²ÎÊý±ØÐëÊÇÒ»¸öÕûÊý³£Á¿¡£Èç¹û¸ø¶¨Á½¸ö²ÎÊý£¬µÚÒ»¸ö²ÎÊýÖ¸¶¨µÚÒ»¸ö·µ»Ø¼Ç¼ÐÐµÄÆ«ÒÆÁ¿£¬µÚ¶þ¸ö²ÎÊýÖ¸¶¨·µ»Ø¼Ç¼ÐеÄ×î´óÊýÄ¿¡£³õʼ¼Ç¼ÐÐµÄÆ«ÒÆÁ¿ÊÇ 0(¶ø²»ÊÇ 1)£º ΪÁËÓë PostgreSQL ¼æÈÝ£¬MySQL Ò²Ö§³Ö¾ä·¨£º LIMIT # OFFSET #¡£
mysql> SELECT * from table LIMIT 5,10; // ¼ìË÷¼Ç¼ÐÐ 6-15
//ΪÁ˼ìË÷´Óijһ¸öÆ«ÒÆÁ¿µ½¼Ç¼¼¯µÄ½áÊøËùÓеļǼÐУ¬¿ÉÒÔÖ¸¶¨µÚ¶þ¸ö²ÎÊýΪ -1£º
mysql> SELECT * from table LIMIT 95,-1; // ¼ìË÷¼Ç¼ÐÐ 96-last.
//Èç¹ûÖ»¸ø¶¨Ò»¸ö²ÎÊý£¬Ëü±íʾ·µ»Ø×î´óµÄ¼Ç¼ÐÐÊýÄ¿£º
mysql> SELECT * from table LIMIT 5;     //¼ìË÷ǰ 5 ¸ö¼Ç¼ÐÐ
//»»¾ä»°Ëµ£¬LIMIT n µÈ¼ÛÓÚ LIMIT 0,n¡£
×¢Òâlimit 10ºÍlimit 9£¬1µÄ²»Í¬£º
ÀýÈ磺
1.
Select * from cyclopedia Where ID>=(
Select Max(ID) from (
Select ID from cyclopedia Order By ID limit 90001
) As tmp
) limit 100;
2.
Select * from cyclopedia Where ID>=(
Select Max(ID) from (
Select ID from cyclopedia Order By ID limit 90000,1
) As tmp
) limit 100;
ͬÑùÊÇÈ¡90000Ìõºó100Ìõ¼Ç¼,µÚ1¾ä¿ì»¹ÊǵÚ2¾ä¿ì?
µÚ1¾äÊÇÏÈÈ¡ÁËǰ90001Ìõ¼Ç¼,È¡ÆäÖÐ×î´óÒ»¸öIDÖµ×÷ΪÆðʼ±êʶ,È»ºóÀûÓÃËü¿ÉÒÔ¿ìËÙ¶¨Î»ÏÂ100Ìõ¼Ç¼
µÚ2¾äÔñÊǽö½öÈ¡90000Ìõ¼Ç¼ºó1Ìõ,È»ºóÈ¡IDÖµ×÷Æðʼ±êʶ¶¨Î»ÏÂ100Ìõ¼Ç¼
µÚ1¾äÖ´Ðнá¹û.100 rows in set (0.23) sec
µÚ2¾äÖ´Ðнá¹û.100 rows in set (0.19) sec
ÆäʵµÚ2¾äÍêÈ«¿ÉÒÔ¼ò»¯³É£º
Select * from cyclopedia Where ID>=(
Select ID from cyclopedia limit 90000,1
)limit 100;
Ö±½ÓÀûÓõÚ90000Ìõ¼Ç¼µÄID,²»Óþ­¹ýMaxÔËËã,ÕâÑù×öÀíÂÛÉÏЧÂÊÒò¸Ã¸ßһЩ,µ«ÔÚʵ¼ÊʹÓÃÖм¸ºõ¿´²»µ½Ð§¹û,ÒòΪ±¾Éí¶¨Î»ID·µ»ØµÄ¾ÍÊÇ1Ìõ¼Ç¼,Max¼¸ºõ²»ÓÃÔË×÷¾ÍÄܵõ½½á¹û,µ«ÕâÑùд¸üÇåäÀÃ÷ÀÊ,ʡȥÁË»­ÉßÄÇÒ»×ã.
Select Top 100 * from cyclopedia Where ID>=(
Select Top 90001 Max(ID) from (
Select ID from cyclopedia Order By ID
) As tmp
)
µ«²»¹ÜÊÇʵÏÖ·½


Ïà¹ØÎĵµ£º

MySQL Proxy°²×°ºÍʹÓÃ(Ò»)

°´ÕÕÊֲᰲװMySQL Proxy֮ǰÏÈÒª°²×°ÒÔÏÂÈí¼þ libevent 1.x or higher (1.3b or later is preferred) lua 5.1.x or higher glib2 2.6.0 or higher pkg-config libtool 1.5 or higher MySQL 5.0.x or higher developer files rpm²é¿´libevent $rpm -q libevent
libevent-1.1a-3.2. ......

CÓïÑÔÁ¬½ÓMySQLÖÐÎÄÎÊÌâ

ÔÚѧϰ£¼Linux³ÌÐòÉè¼Æ£¾µÚ8ÕÂMySQLÊý¾Ý¿â8.3½Ú£º
ʹÓÃCÓïÑÔ·ÃÎÊMySQL·ÃÎÊÊý¾Ý¿âʱ³¢ÊÔ°ÑSQLÊý¾Ý»»³ÉÁËÖÐÎÄ£¬µ«ÊÇÔÚÔËÐÐʾÀý³ÌÐòʱÖÕ¶ËÊä³öÈ´ÂÒÂ룬MySQL C ÓïÑÔÁ¬½ÓĬÈÏ×Ö·û¼¯ÊÇlatin1
²éÁËÏÂAPIÕÒµ½ÈçϺ¯Êý¿É½â¾öÖÐÎÄÂÒÂëÎÊÌâ¡£
int
mysql_set_character_set(
MYSQL *
mysql,
char
*
csname)
ÃèÊö
¸Ãº¯ÊýÓ ......

Ubuntu9.10ϰ²×°Mysql 5.5.0 M2

×÷Õߣº°½Ê¿Î°
Mysql ÓõÄÊÇLinux (non RPM packages)
 
Ò»¡¢½«mysql-5.5.0-m2-linux-i686-glibc23.tar.gzÏÂÔØµ½/home/ikmb ²¢ÔÚµ±Ç°Ä¿Â¼½âѹ£»
 
……..
mysql-5.5.0-m2-linux-i686-glibc23/data/mysql/
mysql-5.5.0-m2-linux-i686-glibc23/data/test/
…………
& ......

t00lsÌṩMysql sha1²Êºç±í(»Ò³£Ç¿´ó)

½éÉÜ£º
mysql sha1
a¡£ 1 -- 11λ Êý×Ö
b¡£ 1 --  8λ  Сд×Öĸ
c¡£ 1  --  8λ  Сд×Öĸ +  Êý×Ö
d¡£ 1 --  7λ   ×Öĸ + Êý×Ö + ·ûºÅ
e¡£  1 --  8λ´óд×Öĸ 
»¹ÔÚ¼ÌÐøÉú³ÉÖÐ,ÕæÅå·þÄÌÍ·Õ⺢×ÓŪÁ˺ü¸¸öÔÂÁË¡£
ÏÂÔØµØÖ·
http://down.5luyu.cn ......

MySQLѧϰ(7)varchar

      ½ñÌ콨һ¸öUTF-8µÄ±í£¬ÆäÖÐÈýÁж¼ÓÃÁËvarcharÕâ¸öÊý¾ÝÀàÐÍ£¬ÎÊÌâ¾ÍÕâôÀ´ÁË£¬ÎÒµÄÈý¸ö×ֶγ¤¶È¼ÓÆðÀ´³¬¹ýÁË65535×Ö½Ú¡£ÒÔǰÒÔΪÿһ¸ö×Ö¶Î×î´óΪ65535£¬Ïë²»µ½Ò»¸ö±í¹²Ïí65535×Ö½Ú¡£Òâ˼ÊÇ˵Èý¸ö×ֶγ¤¶È¼ÓÆðÀ´²»Äܳ¬¹ý65535£¬¶ø²ÉÓÃUTF-8µÄ»°£¬Ò»¸ö×Ö·ûÊÇÕ¼Èý¸ö×ֽڵġ£¼´Èý×Ö¶Î¼ÓÆðÀ´µÄ×Ü ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ