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

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”¿Î³ÌµÍµÄËùÓÐͬѧµÄѧºÅ¡¢ÐÕÃû£»
Select S#,Sname from (select Student.S#,Student.Sname,score ,(select score from SC SC_2 where SC_2.S#=Student.S# and SC_2.C#='002') score2
from Student,SC where Student.S#=SC.S# and C#='001') S_2 where score2 <score;
9


Ïà¹ØÎĵµ£º

SQL Server 2000Êý¾Ý¿âµÄ¶¨Ê±±¸·ÝÉèÖÃ

ÀûÓÃSQL2000µÄ¶¨Ê±±¸·Ý¹¦ÄÜ£¬ÄܺܺöԷþÎñÆ÷ÉϵÄÖØÒªÊý¾ÝÐÅÏ¢½øÐÐÍêÕûµÄ¶¨Ê±±¸·Ý£¬ÒÔ±ãÔÚ·þÎñÆ÷̱»¾»òÊý¾Ý¿â³öÏÖËð»µÊ±¼°Ê±µÄ½øÐлָ´¹¤×÷£¬ÒÔÈ·±£Æ½Ê±µÄ¹¤×÷ÄÜÕý³£µÄ½øÐС£ÏÂÃæÏò´ó¼Ò½éÉÜÒ»ÏÂSQL2000¶¨ÆÚ±¸·ÝµÄÉèÖ÷½·¨£¬¾ßÌåÈçÏ£º
1.         ´ò¿ªSQL2000µÄÆóÒµ¹ÜÀíÆ÷
2.&nbs ......

½²½âSQL ServerÊý¾Ý¿â±»¹ÒÂíµÄ½â¾ö·½°¸

½²½âSQL ServerÊý¾Ý¿â±»¹ÒÂíµÄ½â¾ö·½°¸
http://www.cnhacker.com/Security/Plan/200808/t20080822_6383.html
°¸Àý£ºÒ»¸öÍøÕ¾ÔâÓöÈëÇÖ£¬ÆÆ»µÏ൱ÑÏÖØ£¬SQLÊý¾Ý¿â±»¹ÒÂí£¬ËùÓеıíÀïÃæ´ó²¿·Ö×ֶζ¼±»¶à´ÎÖظ´²åÈë¹ÒÂí´úÂ룬²é¿´ÈÕÖ¾£¬»¹ºÃûÓÐÉæ¼°µ½·þÎñÆ÷µÄ°²È«£¬Ö»ÊÇÊý¾Ý¿âÄÇÀï³öÏÖÁ˺ܶàÒì³£¾¯¸æ¶øÒÑ£¬Íøվȷʵ´æÔÚ©¶´ ......

ÈçºÎ²é¿´SQL Server 2005°æ±¾ MS2005°æ±¾ MS2000°æ±¾

Ҫȷ¶¨ËùÔËÐÐµÄ SQL Server 2005 µÄ°æ±¾£¬ÇëʹÓà SQL Server Management Studio Á¬½Óµ½ SQL Server 2005£¬È»ºóÔËÐÐÒÔÏ Transact-SQL Óï¾ä£º
SELECT SERVERPROPERTY('productversion'), SERVERPROPERTY ('productlevel'), SERVERPROPERTY ('edition')
½á¹û£º
RTM 2005.90.1399
SQL Server 2005 Service Pack 1 2005.90. ......

ÔÚSQL SERVERµÄ±íÖУ¬ÈçºÎʵÏÖ²¿·Ö¼Ç¼µÄ¸´ÖÆ£¿

ÏÖÓÐSQL SERVERµÄÊý¾Ý±í£¨SalesItem£©,SalestemÓÐÒÔÏÂ×Ö¶Î:¿Í»§±àºÅ£¬ÏîÄ¿±àºÅ£¬¿Í»§Æ·ºÅ£¬»õ±Ò£¬µ¥¼Û£¬ÏúÊÛÔ±¡£ÐèÒª´Ó±íÖÐÈ¡³öC145µÄÊý¾Ý£¬ÔÙ°ÑÕâЩÊý¾ÝµÄ¿Í»§±àºÅ¸ÄΪC522£¬ÔÙ±£´æ»Ø±íSalesItemÎÊÌâ²¹³ä£ºÕâÀïÓÐ2²¿·ÖµÄÊý¾Ý£¬C145µÄÊý¾Ý²»±ä£¬»¹ÊÇÓеģ¬C522·ÝµÄÊý¾ÝÊÇ´Ó±íÖÐÈ¡³öC145¿Í»§±àºÅµÄÊý¾Ý£¬ÔÙ°ÑÕâЩÊý¾ÝµÄ¿Í»§± ......

PL/SQL ʵÏÖ»ù±¾µÄËÄÔòÔËËã

CREATE OR REPLACE PACKAGE BODY PACK_RISK_FUNCTION AS
--- 1 ½«·ûºÅÌæ»»³É#ºÅ »òÐí¿ÉÒÔÓÃÕýÔò±í´ïʽ£¬µ«ÊÇÏÓÂé·³»¹ÊÇÖ±½ÓÓÃÌæ»»
FUNCTION CHANGE_OPERATOR(FORMULA VARCHAR2)
RETURN VARCHAR2
AS
V_FORMULA VARCHAR2(100);
BEGIN
V_FORMULA := REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(FORMULA,'(',''), ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ