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

SQL·ÖÒ³Óï¾ä

±àÂë¹ý³ÌÖÐÓöµ½µÄSQL·ÖÒ³Çé¿ö£¬×ܽ᣺
´ÓÊý¾Ý¿â±íÖеÚMÌõ¼Ç¼¿ªÊ¼¼ìË÷NÌõ¼Ç¼
MySQL£º
ÏȲéѯ·ÖÒ³£¬È»ºóÅÅÐò£º
select * from (select * from student  limit 5,2) pageTable order by id desc  ;
ÏÈÅÅÐò£¬È»ºó²éѯ·ÖÒ³£ºselect * from student order by id desc limit 5,2  ;
Oracle£º
SELECT * from (SELECT ROWNUM r,t1.* from ±íÃû³Æ t1  where rownum < M + N) pageTable where t2.r >= M;
SELECT * from (SELECT ROWNUM r,s.* from student s  where rownum < 7) pageTable where t2.r >= 5


Ïà¹ØÎĵµ£º

¡¾»ã×Ü¡¿SQL CODE ¾­µä·¾«²Ê

Êý¾Ý²Ù×÷Àà SQLHelper.cs
http://www.cnblogs.com/zengxiangzhan/archive/2009/12/31/1636871.html
ÎÞÏÞ¼¶·ÖÀà ´æ´¢¹ý³Ì
http://www.cnblogs.com/zengxiangzhan/archive/2010/01/04/1639220.html
°ÙÍò¼¶·ÖÒ³´æ´¢
http://www.cnblogs.com/zengxiangzhan/archive/2009/09/12/1565313.html
SQL¾­µä¶ÌС´úÂëÊÕ¼¯
htt ......

SQlÊý¾ÝÀàÐÍ( _ ѧSQL¾Í´ÓÊý¾ÝÀàÐÍ¿ªÊ¼°É£¡)

SQlÊý¾ÝÀàÐÍ(-_-ѧSQL¾Í´ÓÊý¾ÝÀàÐÍ¿ªÊ¼°É£¡)
bit    ÕûÐÍ
ÆäÖµÖ»ÄÜÊÇ0¡¢1»ò¿ÕÖµ¡£
ÕâÖÖÊý¾ÝÀàÐÍÓÃÓÚ´æ´¢Ö»ÓÐÁ½ÖÖ¿ÉÄÜÖµµÄÊý¾Ý£¬ÈçYes »òNo¡¢True »òFalse ¡¢On »òOff.
int    ÕûÐÍ 4¸ö×Ö½Ú
´Ó- 2^31(-2147483648)µ½2^31 (2147483 647)Ö®¼äµÄÕûÊý¡£
´æ´¢µ½Êý¾Ý¿âµÄ¼¸ºõËùÓÐÊýÖµÐ͵ÄÊý¾ ......

[SQL]´æ´¢¹ý³ÌµÄʹÓÃ

1.ÔÚmssql´´½¨´æ´¢¹ý³Ì,ÔÚdb->´æ´¢¹ý³Ì->н¨´æ´¢¹ý³Ì(ÓÒ¼ü)
CREATE PROCEDURE user_logon_check @username varchar(45),@userpsw varchar(45)
 AS
select * from users where UserName = @username and PasswordCode = @userpsw
return 10
GO
2.ÔÚmysql´´½¨´æ´¢¹ý³Ì,ʹÓÃMysql Query Browser,ÔÚdb->±í ......

SQL¾­µä¶ÌС´úÂëÊÕ¼¯

--SQL Server£º
Select TOP N * from TABLE Order By NewID() 
--Access£º
Select TOP N * from TABLE Order By Rnd(ID)  
Rnd(ID) ÆäÖеÄIDÊÇ×Ô¶¯±àºÅ×ֶΣ¬¿ÉÒÔÀûÓÃÆäËûÈκÎÊýÖµÀ´Íê³É£¬±ÈÈçÓÃÐÕÃû×Ö¶Î(U ......

¹ØÓÚSQLʱ¼äÀàÐ͵ÄÄ£ºý²éѯ

½ñÌìÓÃtime Like '2008-06-01%'Óï¾äÀ´²éѯ¸ÃÌìµÄËùÓÐÊý¾Ý£¬±»ÌáʾÓï¾ä´íÎó¡£²éÁËһϲŷ¢ÏÖ¸ÃÄ£ºý²éѯֻÄÜÓÃÓÚStringÀàÐ͵Ä×ֶΡ£
×Ô¼ºÒ²²éÔÄÁËһЩ×ÊÁÏ¡£¹ØÓÚʱ¼äµÄÄ£ºý²éѯÓÐÒÔÏÂÈýÖÖ·½·¨£º
 
1.Convertת³ÉString,ÔÚÓÃLike²éѯ¡£
select * from table1   where c ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ