SQL²»Ã÷°× - MS-SQL Server / Ó¦ÓÃʵÀý
²éѯѧÉúƽ¾ù³É¼¨¼°ÆäÃû´Î
SELECT 1+(SELECT COUNT( distinct ƽ¾ù³É¼¨)
from (SELECT S#,AVG(score) AS ƽ¾ù³É¼¨
from SC
GROUP BY S#
) AS T1
WHERE ƽ¾ù³É¼¨ > T2.ƽ¾ù³É¼¨) as Ãû´Î,
S# as ѧÉúѧºÅ,ƽ¾ù³É¼¨
from (SELECT S#,AVG(score) ƽ¾ù³É¼¨
from SC
GROUP BY S#
) AS T2
ORDER BY ƽ¾ù³É¼¨ desc;
Óï¾ä²»ÊǺÜÀí½â°¡¡£°ïÏÂÎÒ°É
ÓïÑÔ²»Ì«ºÃ±í´ï£¬°ï¶¥°É
SQL code:
--¼ÆËã¾ù·Ö
SELECT S#,AVG(score) ƽ¾ù³É¼¨
from SC
GROUP BY S#
--°´ÕÕѧºÅ¼ÆËãƽ¾ù·Ö£¬²¢È¡µÃ¸ßÓÚ¾ù·ÖµÄͬѧµÄ¸öÊý
SELECT COUNT( distinct ƽ¾ù³É¼¨)
from (SELECT S#,AVG(score) AS ƽ¾ù³É¼¨
from SC
GROUP BY S#
) AS T1
WHERE ƽ¾ù³É¼¨ > T2.ƽ¾ù³É¼¨
--²»¹ý²»ÖªµÀΪºÎ+1£¿
SQL code:
--Ŷ£¬ÕâÑùһĿÁËÈ»ÁË£¬ÆäʵÄã¾ÍÊÇÔÚ¸øѧÉúÅÅÃû´Î¡£
create view view_acg_scor as select s# ѧºÅ,avg(score) ƽ¾ù³É¼¨ from SC group by s#
SELECT 1+(SELECT COUNT( distinct ƽ¾ù³É¼¨)
from view_acg_score AS T1
Ïà¹ØÎÊ´ð£º
ÎÒÒ»¸öÏîÄ¿£¬Óиö²åÈë²Ù×÷£¬¾ßÌåÊÇÕâÑùµÄ£º
ÎÒÓнø»õÐÅÏ¢±í¡£ÔÚ³ö»õʱѡÔñÏàÓ¦µÄ½ø»õÐÅÏ¢£¬ÊäÈëÊýÁ¿£¬Ñ¡Ôñ²¿Ãź󣬵㱣´æ°´Å¥£¬ÓÉÓÚÍøÂçÑÓʱ£¬µãÒ»ÏÂûÓз´Ó³£¬ÓÚÊÇÓû§¾ÍÓÖµãһϣ¬µ¼ÖÂÒ»´Î²åÈëÁËÁ½Ìõ¼Ç¼:
Àý£º
......
3̨µçÄÔ£¬ÆäÖÐһ̨×÷ΪMYSQL·þÎñÆ÷£¬ÁíÍâ2̨ΪTOMCAT·þÎñÆ÷¡£
MYSQL·þÎñÆ÷ÀïÓÐÒ»Ìõ¼Ç¼£¬ IDΪ10.
ÏÖÔÚ2̨TOMCATͬʱ£¨100%£©·¢ÆðÐÞ¸ÄMYSQLÀïIDΪ10µÄÄÇÌõ¼Ç¼£¬±ÈÈçÐ޸ĴËID¼Ç¼ÀïijһÏîµÄÄÚÈÝ¡£ ±ÈÈçTOMCAT 1Ò ......
ÏÂÃæÊÇXML³õʼÎļþÄÚÈÝ
XML code:
<upd:Update xmlns:lar="http://schemas.microsoft.com/msus/2002/12/LogicalApplicabilityRules" xmlns:cmd="http://schemas.microsoft.com/msus/2002/12/Up ......
ÐèÇóÈçÏ£º
ѧԺ academy£¨aid,aname£©
°à¼¶ class£¨cid,cname,aid£©
ѧÉú stu(sid,sname,aid,cid)
סËÞÇø region(rid,rname)
ËÞÉáÂ¥ build(bid,rid,bnote) bnoteÊÇ¡®ÄС¯/¡®Å®¡¯
ËÞÉá dorm(did,rid,bid£¬bedn ......
select kes.k from
(SELECT acct.KesKigo+acct.KesNo as ak from acct) as a,
(SELECT count(acct.KesKigo+acct.KesNo) as k from acct, fd_user where acct.ActNo = fd_user.ActNo
group ......