µ±Ç°Î»ÖãºÊ×Ò³ > Êý¾Ý¿âϵͳ¸ÅÂÛʵÑ鱨¸æ(È«)
2¡¢²éѯ¿¼ÊԳɼ¨²»¼°¸ñµÄѧÉúµÄѧºÅ, ¿Î³ÌºÅ£¬³É¼¨¡£
select sno,cno,grade from SC
where Grade<60
3¡¢¼ÆËãÑ¡ÐÞÁË1ºÅ¿Î³ÌµÄѧÉúƽ¾ù³É¼¨,ÒªÇóÏÔʾѧºÅºÍƽ¾ù³É¼¨¡£
select sno,avg(grade)as avggrade from SC
where sno in (select sno from SC
where Cno='1') group by sno
4¡¢²éѯÿ¸öϵÄêÁä×î´óµÄѧÉúµÄѧºÅ£¬ÄêÁä¡£
select Sno,sage
from(select sdept,max(sage)as xsage from Student
group by sdept)as x,student
where x.Sdept=Student.Sdept and x.xsage=student.sage order by sno
5¡¢²éѯûÓÐÑ¡ÐÞ¹ý¡°ÀîÃ÷¡±ÀÏʦ½²Êڿγ̵ÄËùÓÐѧÉúÐÕÃû¡£
select sname from student
where sno not in(select sno from sc
where cno=(select cno from course
where cteacher='ÀîÃ÷'))
6¡¢²éѯÓжþÃÅÒÔÉÏ(º¬Á½ÃÅ)²»¼°¸ñ¿Î³ÌµÄѧÉúÐÕÃû
select sname
from student, (select Sno,COUNT(sno) as x from SCc
where Grade<60 group by sno) as y
where y.sno=Student.Sno and y.x>=2 (ÒòËù½¨±íÖв¢Ã»ÓÐÕâÖÖÇé¿ö,¹Ê²»½ØÍ¼)
7¡¢²éѯ¼Èѧ¹ý¡°1¡±ºÅ¿Î³Ì£¬ÓÖѧ¹ý¡°2¡±ºÅ¿Î³ÌµÄËùÓÐѧÉúÐÕÃû
select sname
from Student,SC
where student.sno =sc.sno and Cno='1' and Cno='2'
8¡¢²éѯѡÐ޵Ŀγ̵ijɼ¨´óÓÚ¸Ã¿Î³ÌµÄÆ½¾ù³É¼¨µÄËùÓÐѧÉúÐÕÃû
select sname from student
where sno in (select sno
from SC,(select cno,AVG(grade) as x from SC
group by cno) as y where SC.Cno=y.Cno and SC.Grade>x group by sno)
ËÄ¡¢ Ö÷ÒªÒÇÆ÷É豸¼°ºÄ²Ä
PC»úһ̨
Îå¡¢ ˼¿¼ÌÖÂÛÌâ»òÌå»á»ò¶Ô¸Ä½øÊµÑéµÄ½¨Òé
(1)ÔÚµ÷ÊÔʱ,Óöµ½Ê²Ã´ÎÊÌâ?ÊÇÔõÑù½â¾öµÄ? (2)ͨ¹ýʵÑé,»ñµÃÄÄЩÊÕ»ñ¡¢Ìå»á? Áù¡¢ ²Î¿¼×ÊÁÏ
ÎÀÁÕ ¡¶SQL SERVER 2008Êý¾Ý¿âÓ¦ÓÃÓ뿪·¢½Ì³Ì¡·Ç廪´óѧ³ö°æÉç 2011.6
¹²·ÖÏí92ƪÏà¹ØÎĵµ