50¸ö³£ÓõÄSQLÓï¾ä
Student(S#,Sname,Sage,Ssex) ѧÉú±í
Course(C#,Cname,T#) ¿Î³Ì±í
SC(S#,C#,score) ³É¼¨±í
Teacher(T#,Tname) ½Ìʦ±í
ÎÊÌ⣺
1¡¢²éѯ“001”¿Î³Ì±È“002”¿Î³Ì³É¼¨¸ßµÄËùÓÐѧÉúµÄѧºÅ£»
select a.S# from (select s#,score from SC where C#='001') a,(select s#,score
from SC where C#='002') b
where a.score>b.score and a.s#=b.s#;
2¡¢²éѯƽ¾ù³É¼¨´óÓÚ60·ÖµÄͬѧµÄѧºÅºÍƽ¾ù³É¼¨£»
select S#,avg(score)
from sc
group by S# having avg(score) >60;
3¡¢²éѯËùÓÐͬѧµÄѧºÅ¡¢ÐÕÃû¡¢Ñ¡¿ÎÊý¡¢×ܳɼ¨£»
select Student.S#,Student.Sname,count(SC.C#),sum(score)
from Student left Outer join SC on Student.S#=SC.S#
group by Student.S#,Sname
4¡¢²éѯÐÕ“ÀÄÀÏʦµÄ¸öÊý£»
select count(distinct(Tname))
from Teacher
where Tname like 'Àî%';
5¡¢²éѯûѧ¹ý“Ҷƽ”ÀÏʦ¿ÎµÄͬѧµÄѧºÅ¡¢ÐÕÃû£»
select Student.S#,Student.Sname
from Student
where S# not in (select distinct( SC.S#) from SC,Course,Teacher where SC.C#=Course.C# and Teacher.T#=Course.T# and Teacher.Tname='Ҷƽ');
6¡¢²éѯѧ¹ý“001”²¢ÇÒҲѧ¹ý±àºÅ“002”¿Î³ÌµÄͬѧµÄѧºÅ¡¢ÐÕÃû£»
select Student.S#,Student.Sname from Student,SC where Student.S#=SC.S# and SC.C#='001'and exists( Select * from SC as SC_2 where SC_2.S#=SC.S# and SC_2.C#='002');
7¡¢²éѯѧ¹ý“Ҷƽ”ÀÏʦËù½ÌµÄËùÓпεÄͬѧµÄѧºÅ¡¢ÐÕÃû£»
select S#,Sname
from Student
where S# in (select S# from SC ,Course ,Teacher where SC.C#=Course.C# and Teacher.T#=Course.T# and Teacher.Tname='Ҷƽ' group by S# having count(SC.C#)=(select count(C#) from Course,Teacher where Teacher.T#=Course.T# and Tname='Ҷƽ'));
8¡¢²éѯ¿Î³Ì±àºÅ“002”µÄ³É¼¨±È¿Î³Ì±àºÅ“001”¿Î³ÌµÍµÄËùÓÐͬѧµÄѧºÅ¡¢ÐÕÃû£»&nbs
Ïà¹ØÎĵµ£º
1. ʲôÊÇÃüÃû¹ÜµÀ£¿
ÓëTCP/IP£¨´«Êä¿ØÖÆÐÒé»òinternetÐÒ飩һÑù£¬ÃüÃû¹ÜµÀÊÇÒ»ÖÖͨѶÐÒé¡£ËüÒ»°ãÓÃÓÚ¾ÖÓòÍøÖУ¬ÒòΪËüÒªÇó¿Í»§¶Ë±ØÐë¾ßÓзÃÎÊ·þÎñÆ÷×ÊÔ´µÄȨÏÞ¡£
Òª½âÊÍÕâ¸öÎÊÌ⣬ÎÒ»¹ÊÇժ¼΢Èí¹Ù·½µÄ×ÊÁϱȽϺÃ
http://msdn.microsoft.com/zh-cn/library/ms187892.aspx
ÈôÒªÁ¬½Óµ½ SQL Server Êý¾Ý¿âÒýÇ棬±ØÐëÆô ......
1¡¢×éºÏÓï¾äÖ´ÐÐ
BEGIN ATOMIC
±í´ïʽ1 ·ÖºÅ ¿Õ¸ñ/»Ø³µ
±í´ïʽ2 ·ÖºÅ ¿Õ¸ñ/»Ø³µ
END
2¡¢Ó¦¸ÃÏÞÖÆ·ÃÎÊȨÏÞµÄ±í£¨Ó¦¸Ã³·ÏúÕâЩ±íPUBLIC SELECT·ÃÎÊȨ£©
SYSCAT.DBAUTH
SYSCAT.TABAUTH
SYSCAT.PACKAGEAUTH
SYSCAT.INDEXAUTH
SYSCAT.COLAUTH
SYSCAT.PASSTHRUAUTH
SYSCAT.SCHEMAAUTH
±È½ÏÓÐÓõÄĿ¼± ......
¸Õ¸Õ×°ÁËSQL2008£¬ÅäÖÃÁËһϣ¬ÔÚÍøÉÏÕÒµ½Õâ¸ö½Ì³Ì£¬¾õµÃ²»´í£¬×ªÔØѧϰ
1¡¢ ¸ü¸ÄTCP/IPÁ¬½ÓΪÆôÓÃ
2¡¢ µÇ¼ £¬ ÐÞ¸Ä2¸öµØ·½
a) Éí·ÝÑéÖ¤·½Ê½£¨»ìºÏģʽ£©
ͼһ£ºÊ×ÏÈʹÓÃwindowsÉí·ÝµÇ¼£¨×¢Ò⣬ ·þÎñÆ÷Ãû³Æ±ØÐëÌîдÕýÈ·£©
  ......
SELECT * from xcmis.temp_odr_prom@linkxceis where trim(ODR_NO) like 'CA10010082'
SELECT * from xcmis.temp_odr_prom@linkxceis where ODR_NO like 'CA10010082%'
SELECT * from xcmis.temp_odr_prom@linkxceis where ODR_NO = 'CA10010082'
OK
SELECT * from xcmis.temp_odr_prom@linkxceis where ODR_NO like 'C ......
ÉÏ΢ÈíÍøÕ¾ÏÂÔØsqlserver2005 jdbc driver °ü
1¡¢½«microsoft sql server 2005 jdbc driver\sqljdbc_1.2\chs\sqljdbc.jar°ü copyµ½·¢²¼ÏµÍ³ µÄ web-inf\libĿ¼ÖÐ
2¡¢½«microsoft sql server 2005 jdbc driver\sqljdbc_1.2\chs\auth\x86\sqljdbc_auth.dll Îļþcopyµ½ windows ......