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

SQL

ÌâÄ¿1:
ÎÊÌâÃèÊö:
 S (SNO,SNAME) ѧÉú¹Øϵ¡£SNO ΪѧºÅ£¬SNAME ΪÐÕÃû
 C (CNO,CNAME,CTEACHER) ¿Î³Ì¹Øϵ¡£CNO Ϊ¿Î³ÌºÅ£¬CNAME Ϊ¿Î³ÌÃû£¬CTEACHER ΪÈονÌʦ
 SC(SNO,CNO,SCGRADE) Ñ¡¿Î¹Øϵ¡£SCGRADE Ϊ³É¼¨
 1.£¨1£©ÕÒ³öÑ¡ÐÞ¹ý“ÀîÃ÷”ÀÏʦ½²Êڿγ̵ÄËùÓÐѧÉúÐÕÃû
 --ʵÏÖ´úÂë:·¨Ò»
Select *
from SC,C,S
Where SC.CNO=C.CNO AND SC.SNO=S.SNO AND CTEACHER='ÀîÃ÷'
---·¨¶þ£º-------------
Select *
from S
Where Sno IN( Select Sno
              from C,SC
              Where C.[Cno]=SC.[Cno] AND CTEACHER='ÀîÃ÷')
 
£¨2£©ÕÒ³öûÓÐÑ¡ÐÞ¹ý“ÀîÃ÷”ÀÏʦ½²Êڿγ̵ÄËùÓÐѧÉúÐÕÃû
 --ʵÏÖ´úÂë:·¨Ò»
Select SName
from S
Where [Sno] NOT IN( Select SC.[Sno]
                    from SC,C
                    Where SC.CNO=C.CNO AND CTEACHER='ÀîÃ÷')
 
£¨3£©ÕÒ³öûÓÐÑ¡ÐÞ¹ý¿Î³ÌºÅΪ"1"µÄËùÓÐѧÉúÐÕÃû
 --ʵÏÖ´úÂë
Select SName
from S
Where [Sno] NOT IN( Select [Sno] from SC Where CNO='1')
 
------------------------------------------------------------------------------------------------------------------------------------------
 2. ÁгöÓжþÃÅÒÔÉÏ(º¬Á½ÃÅ)²»¼°¸ñ¿Î³ÌµÄѧÉúÐÕÃû¼°Æäƽ¾ù³É¼¨
 --ʵÏÖ´úÂë:
Select S.SNO,S.SNAME,AVG_SCGRADE=AVG(SC.SCGRADE)
from S,SC,( Select SNO
                     from SC
                     Where SCGRADE<60
                     GROUP BY SNO
  &nb


Ïà¹ØÎĵµ£º

SQL_ѧÉú

 
µÚ¶þ²¿·Ö
1.ËùÓÐÄÐÉúµÄÐÕÃû¡¢ÄêÁä:
Select Sname£¬Sage
from student;
2.ËùÓÐÄêÁä´óÓÚ20£¬¼ÆËã»ú¿ÆѧϵѧÉúÃûµ¥:
SELECT Sname
from Student
WHERE Sage>20 AND Sdept='CS';
3.³É¼¨´óÓÚ60µÄѧÉúѧºÅ:
SELECT Sno
from SC
WHERE Grade>60;
4.³É¼¨ÔÚ70µ½80Ö®¼äµÄѧÉúѧºÅ:
SELECT Sno
from SC ......

JavaÊý¾Ý¿â°üjava.sql.*Ïê½â(jdk1.6)

1:Ó¦ÓóÌÐò²»ÔÙÐèҪʹÓà Class.forName() ÏÔʽµØ¼ÓÔØ JDBC Çý¶¯³ÌÐò¡£µ±Ç°Ê¹Óà Class.forName() ¼ÓÔØ JDBC Çý¶¯³ÌÐòµÄÏÖÓгÌÐò½«ÔÚ²»×÷Ð޸ĵÄÇé¿öϼÌÐø¹¤×÷¡£
2:ÐèҪעÒâÒÔÏÂÃüÁ
executeUpdate£ºÊÇ×î»ù´¡µÄÊý¾Ý¿âµÄ¸üС¢²åÈëºÍɾ³ý²Ù×÷¡£Ð§ÂʵÍÏ¡£   
executeQuery£ºÊÇ×î»ù´¡µÄÖ´ÐвéѯÓï¾ä£¬Í¬Ñù ......

sql sa怬

 ÎÊÌâÒ»¡¢Íü¼ÇÁ˵ǼMicrosoft SQL Server 2005 µÄsaµÄµÇ¼ÃÜÂë
½â¾ö·½·¨£ºÏÈÓÃwindowsÉí·ÝÑéÖ¤µÄ·½Ê½µÇ¼½øÈ¥£¬È»ºóÔÚ‘°²È«ÐÔ’-‘µÇ¼’-ÓÒ¼üµ¥»÷‘sa’-‘ÊôÐÔ’£¬ÐÞ¸ÄÃÜÂëµã»÷È·¶¨¾Í¿ÉÒÔÁË¡£
ÎÊÌâ¶þ¡¢Òѳɹ¦Óë·þÎñÆ÷½¨Á¢Á¬½Ó£¬µ«ÊÇÔڵǼ¹ý³ÌÖз¢Éú´íÈ¡¡££¨provider:¹ ......

Ò»ÌõSQLÓï¾ä£¬¹ØÓÚ×Ö·û·Ö¸î¹ØÁª¶àÌõ¼Ç¼µÄÎÊÌâ

 Ô­ÎÄ´«ËÍÃÅ£ºhttp://topic.csdn.net/u/20091010/14/FC7737C1-D60B-43F1-A8B5-A9EEF2DE4426.html
¼ÙÈçÏÖÔÚÓÐÁ½ÕÅ±í£º
1.±ístuinfo
sid sname subs
1  jack  |1|2|
2  marry |1|4|
3  tom  |3|
2.±ísubinfo
subid  subname
1      physics
2  &n ......

SQLÊý¾Ý¿âÉè¼Æ¼¼ÇÉdz̸

Êý¾Ý¿âÉè¼Æ¾­Ñé̸
 
Ò»¸ö³É¹¦µÄ¹ÜÀíϵͳ£¬ÊÇÓÉ£º[50% µÄÒµÎñ + 50% µÄÈí¼þ] Ëù×é³É£¬¶ø 50% µÄ³É¹¦Èí¼þÓÖÓÐ [25% µÄÊý¾Ý¿â + 25% µÄ³ÌÐò] Ëù×é³É£¬Êý¾Ý¿âÉè¼ÆµÄºÃ»µÊÇÒ»¸ö¹Ø¼ü¡£Èç¹û°ÑÆóÒµµÄÊý¾Ý±È×öÉúÃüËù±ØÐèµÄѪҺ£¬ÄÇôÊý¾Ý¿âµÄÉè¼Æ¾ÍÊÇÓ¦ÓÃÖÐ×îÖØÒªµÄÒ»²¿·Ö¡£ÓйØÊý¾Ý¿âÉè¼ÆµÄ²ÄÁϺ¹Å£³ä¶°£¬´óѧѧλ¿Î³ÌÀïÒ²ÓÐ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ