SQL¾µä¶ÌС´úÂëÊÕ¼¯
--SQL Server£º
Select TOP N * from TABLE Order By NewID()
--Access£º
Select TOP N * from TABLE Order By Rnd(ID)
Rnd(ID) ÆäÖеÄIDÊÇ×Ô¶¯±àºÅ×ֶΣ¬¿ÉÒÔÀûÓÃÆäËûÈκÎÊýÖµÀ´Íê³É£¬±ÈÈçÓÃÐÕÃû×Ö¶Î(UserName)
Select TOP N * from TABLE Order BY Rnd(Len(UserName))
--MySql£º
Select * from TABLE Order By Rand() Limit 10
--¿ªÍ·µ½NÌõ¼Ç¼
Select Top N * from ±í
--Nµ½MÌõ¼Ç¼(ÒªÓÐÖ÷Ë÷ÒýID)
Select Top M-N * from ±íWhere ID in (Select Top M ID from ±í) Order by ID Desc
--Ñ¡Ôñ10´Óµ½15µÄ¼Ç¼
select top 5 * from (select top 15 * from table order by id asc) table_±ðÃûorder by id desc
--Nµ½½áβ¼Ç¼
Select Top N * from ±íOrder by ID Desc
--ÏÔʾ×îºó5Ìõ¼Ç¼,µ«ÊÇÏÔʾµÄ˳Ðò±ØÐëΪ5,6,7,8,9,10,¶ø²»ÊÇ10,9,8,7,6,5 ÈçϽâ¾ö·½·¨:
select top 5 from test where id in(select top 5 from test order by id desc) order by id asc
--ͨ¹ýÕâ¸öÎÊÌâÒ²ÄÜ×ܽá³ö4-10Ìõ,5-100ÌõÕâÖÖÏÞ¶¨Ò»¶¨·¶Î§ÄÚµÄsqlÓï¾äµÄд·¨:
select top <Ä©¶ËID-¶¥¶ËID+1> * from <±íÃû> where ID not in(select top <¶¥¶ËID-1>) ID from <±íÃû>)
--ÀýÈç:4-10Ìõ¾ÍÓ¦¸Ãд³É
select top 10-4+1 * from test where id not in(select top 4-1 id from test)
ÉÏһƪ: select top 1 * from [news_table] where [ÐÂÎűêʶÁÐ]<µ±Ç°idºÅ where ......
ÏÂһƪ: select top 1 * from [news_table] where [ÐÂÎűêʶÁÐ]>µ±Ç°idºÅ where ...... order by [ÐÂÎűêʶÁÐ] desc --Á½Ìõ¼Ç¼ÍêÈ«Ïàͬ£¬ÈçºÎɾ³ýÆäÖÐÒ»Ìõ
set rowcount=1
delete from thetablename where id=@duplicate_id--@duplicate_idΪÖظ´ÖµµÄid
--Ä£ºý²éѯ
select * &nbs
Ïà¹ØÎĵµ£º
ÎÒ¾õµÃÖ÷ÒªÓ¦¸Ã´Ó5¸ö·½Ãæ½øÐе÷Õû£º
1.È¥µô²»±ØÒªµÄ´óÐͱíµÄÈ«±íɨÃè
2.»º´æСÐͱíµÄÈ«±íɨÃè
3.¼ìÑéÓÅ»¯Ë÷ÒýµÄʹÓÃ
4.¼ìÑéÓÅ»¯µÄÁ¬½Ó¼¼Êõ
5.¾¡¿ÉÄܼõÉÙÖ´Ðмƻ®µÄCost
ÏÖÔÚ¼òµ¥µÄ¾Ù¼¸¸öÀý×Ó
Where×Ó¾äÖÐÓГ!=”½«²»Ê¹ÓÃË÷Òý
select account_name from test where amount != 0 (²»Ê¹ÓÃ)
......
SELECT DISTINCT '['+user_name(b.uid)+'].['+b.name+']' AS ¶ÔÏóÃû,b.type AS ÀàÐÍ
from sysdepends a,sysobjects b
WHERE b.id=a.depid
AND a.id=OBJECT_ID('¹ý³ÌÃû');
EXEC SP_DEPENDS '¹ý³ÌÃû';
......
µÚÒ»Õ£ºÐÅÏ¢Ìåϵ½á¹¹ÔÔò
¸ù¾ÝÒÔÏÂ7¸öÏ໥ÒÀÀµµÄÊý¾Ý´æ´¢Ä¿±êÉè¼ÆºÍÆÀ¹ÀÈκÎÊý¾Ý´æ´¢£º
l ¼òµ¥ÐÔ£»
l ÓÐÓÃÐÔ
l Êý¾ÝÍêÕûÐÔ
l ÐÔÄÜ
l ¿ÉÓÃÐÔ
l ¿ÉÀ©Õ¹ÐÔ
l °²È«ÐÔ
¼Ü¹¹Éè¼ÆÔÔò
l ±ÜÃâ¹ýÓÚ¸´ÔÓ
l ¾«ÐÄÌôÑ¡¼ü
l Ê÷Á¢¿ÉÑ¡Êý¾Ý
l ÊµÏ ......
SQLÓï¾ä¼¯½õ
--Óï ¾ä ¹¦ ÄÜ
--Êý¾Ý²Ù×÷
SELECT --´ÓÊý¾Ý¿â±íÖмìË÷Êý¾ÝÐкÍÁÐ
INSERT& ......
ÊÊÓãºORACLE
ÐÞ¸ÄÁÐÃû
alter table xxx rename column aaa to bbb;
ɾ³ýÒ»ÁÐ
alter table xxx drop column aaa;
Ôö¼ÓÒ»ÁÐ
alter ......