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

¡¾×ª¡¿ sqlͳ¼Æ£­¹ØÓÚѧÉú³É¼¨(´ð°¸)

sqlͳ¼Æ£­¹ØÓÚѧÉú³É¼¨(´ð°¸)
http://blog.sina.com.cn/s/blog_61380b320100ej9p.html
´ð°¸£º
1.       ¼ÆËãÿ¸öÈ˵Ä×ܳɼ¨²¢ÅÅÃû
select name,sum(score) as allscore from stuscore group by name order by allscore
2.   ¼ÆËãÿ¸öÈ˵Ä×ܳɼ¨²¢ÅÅÃû
select distinct t1.name,t1.stuid,t2.allscore from  stuscore t1,
(
    select stuid,sum(score) as allscore from stuscore group by stuid
)t2
where t1.stuid=t2.stuid
order by t2.allscore desc
3. ¼ÆËãÿ¸öÈ˵¥¿ÆµÄ×î¸ß³É¼¨
 select t1.stuid,t1.name,t1.subject,t1.score from stuscore t1,
(
select stuid,max(score) as maxscore from stuscore group by stuid
) t2
where t1.stuid=t2.stuid and t1.score=t2.maxscore
4.¼ÆËãÿ¸öÈËµÄÆ½¾ù³É¼¨
select distinct t1.stuid,t1.name,t2.avgscore from stuscore t1,
(
select stuid,avg(score) as avgscore from stuscore group by stuid
) t2
where t1.stuid=t2.stuid
5.Áгö¸÷Ãſγ̳ɼ¨×îºÃµÄѧÉú
select  t1.stuid,t1.name,t1.subject,t2.maxscore from stuscore t1,
(
select subject,max(score) as maxscore from stuscore group by subject
) t2
where t1.subject=t2.subject and t1.score=t2.maxscore
6.Áгö¸÷Ãſγ̳ɼ¨×îºÃµÄÁ½Î»Ñ§Éú
select distinct t1.* from stuscore t1 
where t1.stuid in 
(select top 2 stuscore.stuid from stuscore where subject = t1.subject order by score desc) 
order by t1.subject
 
7.ѧºÅ    ÐÕÃû    ÓïÎÄ     Êýѧ     Ó¢Óï     ×Ü·Ö  Æ½¾ù·Ö
select&nbs


Ïà¹ØÎĵµ£º

ADO.NETºÍSQL SERVERÊý¾Ý¿âÖеÄÊý¾ÝÀàÐͶÔÓ¦¹ØÏµ

ÎÒÃÇÖªµÀ£¬ÔÚSQL SERVERÖÐÓÐBit, Float, Int , CharµÈµÈһϵÁеÄÊý¾ÝÀàÐÍ£¬¶øÔÚDOT NETÖУ¬ÓÐBoolean,Double,Int 32,StringµÈÊý¾ÝÀàÐÍÓëÖ®¶ÔÓ¦¡£ Ò²¾ÍÊÇ˵£¬Êý¾Ý¿âÖеÄÊý¾ÝÀàÐÍÓëDOT NETµÄÊý¾ÝÀàÐÍÖ®¼ä£¬ÓÐÒ»¸öÓ³Éä¹ØÏµ¡£Ï±íÊÇËûÃǵÄÓ³Éä¹ØÏµ£º
 
dot netÖеÄÊý¾ÝÀàÐÍ       &n ......

C# ÓÃSQLн¨Êý¾Ý¿â

1. ³ÌÐòÈçÏ£º
         string str = "Create Database " + "DBname";
         string con = "Data Source=10.0.0.249\\sql2005;Initial Catalog=master;Persist Security Info=True;User ID=sa;Password=sa";
   &n ......

SQLÖ®11 Êý¾Ý¿âÉè¼Æ

º¯ÊýÒÀÀµ
==========================================
Ò»¡¢º¯ÊýÒÀÀµ¸ÅÄî  
    
  ¡¡¡¡º¯ÊýÒÀÀµÊÇ´ÓÊýѧ½Ç¶ÈÀ´¶¨ÒåµÄ£¬ÔÚ¹ØÏµÖÐÓÃÀ´¿Ì»­¹ØÏµ¸÷ÊôÐÔÖ®¼äÏà»¥ÖÆÔ¼¶øÓÖÏ໥ÒÀÀµµÄÇé¿ö¡£º¯ÊýÒÀÀµÆÕ±é´æÔÚÓÚÏÖʵÉú»îÖУ¬±ÈÈ磬ÃèÊöÒ»¸öѧÉúµÄ¹ØÏµ£¬¿ÉÒÔÓÐѧºÅ¡¢ÐÕÃû¡¢ËùÔÚϵµÈ¶à¸öÊôÐÔ£ ......

SQL SERVER 2008 ¸ü¸Ä¸ú×Ù

SQL SERVER 2008 ¸ü¸Ä¸ú×Ù
/*
¿´Ê飬¿´Áª»úÆÚ¼ä¡£¡£¡£Ë³´ø°Ñ¿´µ½µÄдÏÂ
 
ÓëSQL SERVER 2008 CDC Òì²½²¶»ñÊý¾Ý±ä¸üµÄ²»Í¬,¸ü¸Ä¸ú×ÙÊÇͬ²½½ø³Ì,
ÊÇDML(INSERT/UPDATE/DELETE)ÊÂÎñµÄÒ»²¿·Ö,Ëü¿ÉÒÔʹÓÃ×îСµÄCÅÌ´æ´¢
¿ªÏúÀ´Õì²âÊý¾ÝÐеľ»±ä¸ü.ÄÇôËüÒ²¾Í²»ÄÜÏñCDCÄÇÑù¿ÉÒÔÌṩÓû§±íµÄ
ÀúÊ·¸ü¸ÄÐÅÏ¢. ¸ü¸ÄÊÇʹÓÃÒ ......

SQL SERVER200´íÎó´¦Àí ·þÎñÆ÷

´íÎó´¦Àí
ÔÚSQL Server2000ÖгöÏֵĴíÎó¾ßÓÐÒÔϼ¸¸öÌØµã£º
´íÎóºÅ£ºÃ¿¸ö´íÎó״̬¶¼¶ÔӦΨһµÄ´íÎóºÅ¡£
´íÎóÐÅÏ¢×Ö·û´®£º´íÎóÐÅÏ¢ÌṩÁËÓйشíÎóÔ­ÒòµÄÕï¶ÏÐÅÏ¢¡£Ðí¶à´íÎóÐÅÏ¢¶¼ÓÐÌæ»»±äÁ¿£¬ÆäÖаüº¬Ò»Ð©ÐÅÏ¢£¬Èç²úÉú´íÎóµÄ¶ÔÏóÃû³Æ¡£Ã¿¸ö´íÎóºÅ¶¼¶ÔӦΨһµÄ´íÎóÐÅÏ¢¡£
ÑÏÖØ¶È£ºÑÏÖØ¶È±íʾ´íÎóµÄÑÏÖØ³Ì¶È¡£ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ