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

SQLÕù°ÔÈüÊÔÌâ¼°²Î¿¼´ð°¸

1.ijҽԺ²¡·¿¼ÆËã»ú¹ÜÀíÖÐÐèÒªÈçÏÂÐÅÏ¢£º£¨15·Ö£©
¿ÆÊÒ£º¿ÆÃû£¬¿ÆµØÖ·£¬¿Æµç»°
²¡·¿£º²¡·¿ºÅ£¬ËùÊô¿ÆÊÒÃû
Ò½Éú£ºÐÕÃû£¬Ö°³Æ£¬ËùÊô¿ÆÊÒÃû£¬ÄêÁ䣬¹¤×÷Ö¤ºÅ
²¡ÈË£º²¡ÀúºÅ£¬ÐÕÃû£¬ÐÔ±ð£¬Õï¶Ï£¬Ö÷¹ÜÒ½Éú£¬²¡·¿ºÅ£¬ÈëסÈÕÆÚ
ÆäÖУ¬Ò»¸ö¿ÆÊÒÓжà¸ö²¡·¿¡¢¶à¸öÒ½Éú£¬Ò»¸ö²¡·¿Ö»ÄÜÊôÓÚÒ»¸ö¿ÆÊÒ£¬Ò»¸öÒ½ÉúÖ»ÊôÓÚÒ»¸ö¿ÆÊÒ£¬µ«¿É¸ºÔð¶à¸ö²¡È˵ÄÕïÖΣ¬Ò»¸ö²¡È˵ÄÖ÷¹ÜÒ½ÉúÖ»ÓÐÒ»¸ö£¬Ò»¸ö²¡ÈË¿ÉÄÜÔÚ²»Í¬Ê±¼äÈëס²»Í¬µÄ²¡·¿£¬Ò²ÊǾÍ˵һ¸ö²¡ÈËÒ²ÐíÈëס¹ý¶à¼ä²¡·¿£¬Ò»¼ä²¡·¿¿ÉÒÔÈëס¶àÃû²¡ÈË¡£
Íê³ÉÈçÏÂÉè¼Æ£º
£¨1£©       Éè¼Æ¸Ã¼ÆËã»ú¹ÜÀíϵͳµÄE£­Rͼ£¨7·Ö£©£»
´ð°¸£¨ÊµÌåÉϵÄÊôÐÔÃèÊö¼°¹ØϵÃèÊöÂÔ£©»­³öËĸöʵÌåͼ£¬È»ºó¹ØϵÃèÊöÕýÈ·¼´¿É¡£
 
£¨2£©       ½«¸ÃE-Rͼת»»ÎªÊý¾Ý¿âÄ£ÐÍͼ(±íÃûºÍ×Ö¶ÎÃû¶¼¿ÉÒÔÓÃÖÐÎÄÀ´Ð´)£¨8·Ö£©£»
´ð°¸£º
2. £¨75·Ö£©
±íÃû
S
×÷ÓÃ
´æ´¢Ñ§ÉúÐÅÏ¢
Ö÷¼ü
SNO
ÐòºÅ
×Ö¶ÎÃû³Æ
×Ö¶Î˵Ã÷
ÀàÐÍ
ÊôÐÔ
±¸×¢
1
SNO
Ö÷¼ü£¬Ñ§ºÅ
Varchar(5)
·Ç¿Õ
ѧºÅ±ØÐëΪÊý×Ö
2
SName
ѧÉúÐÕÃû
Nvarchar(50)
·Ç¿Õ
ÐÕÃûΨһ
3
Age
ÄêÁä
Int
·Ç¿Õ
1~100
4
Sex
ÐÔ±ð
Nvarchar(1)
·Ç¿Õ
ĬÈÏΪÄУ¬Ö»ÄÜÌîдÄкÍÅ®
 
±íÃû
C
×÷ÓÃ
´æ´¢¿Î³ÌÐÅÏ¢
Ö÷¼ü
CNO
ÐòºÅ
×Ö¶ÎÃû³Æ
×Ö¶Î˵Ã÷
ÀàÐÍ
ÊôÐÔ
±¸×¢
1
CNO
Ö÷¼ü£¬¿Î³ÌºÅ
char(2)
·Ç¿Õ
¿Î³ÌºÅ³¤¶È±ØÐëΪ2
2
CName
¿Î³ÌÃû
Nvarchar(50)
·Ç¿Õ
Ψһ
3
Teacher
ÀÏʦÐÕÃû
Nvarchar(50)
·Ç¿Õ
 
 
±íÃû
SC
×÷ÓÃ
´æ´¢³É¼¨ÐÅÏ¢
Ö÷¼ü
CNO,SNO
ÐòºÅ
×Ö¶ÎÃû³Æ
×Ö¶Î˵Ã÷
ÀàÐÍ
ÊôÐÔ
±¸×¢
1
CNO
¿Î³ÌºÅ£¬Íâ¼ü
char(2)
·Ç¿Õ
¿Î³ÌºÅ³¤¶È±ØÐëΪ2
2
SNO
ѧÉúºÅ£¬Íâ¼ü
Varchar(5)
·Ç¿Õ
ѧºÅ±ØÐëΪÊý×Ö
3
Grade
³É¼¨
Int
·Ç¿Õ
0~100
 
2.1 д³öSQLÓï¾ä£¬½¨Á¢Ñ§ÉúÊý¾Ý¿âStudent£¬²¢°´ÒÔÉÏÒªÇó½¨Á¢±í£¬Ô¼Êø£¨13·Ö£©£¨´ð°¸ÂÔ£©£»
2.2 ²åÈëһϲâÊÔÊý¾Ý£º£¨2·Ö£©
INSERT [C] ([CNO],[CName],[Teacher]) VALUES ( 'k1','CÓïÑÔ','Íõ»ª')
INSERT [C] ([CNO],[CName],[Teacher]) VALUES ( 'K5','Êý¾Ý¿âÔ­Àí','³Ì¾ü')
INSERT [C] ([CNO],[CName],[Teacher]) VALUES ( 'K8','±àÒëÔ­Àí','³Ì¾ü')
 
INSERT [S] ([SNO],[SName],[Age],[sex]) VALUES ( '1','ÀîÇ¿',23,'ÄÐ')
INSERT [S] ([SNO],[SName],[Age],[sex]) VALUES ( '2','ÁõÀö',22,


Ïà¹ØÎĵµ£º

º½¿Õ¹«Ë¾¹ÜÀíϵͳ(VC++ ÓëSQL 2005)

ϵͳ»·¾³£ºWindows 7
Èí¼þ»·¾³£ºVisual C++ 2008 SP1 +SQL Server 2005
±¾´ÎÄ¿µÄ£º±àдһ¸öº½¿Õ¹ÜÀíϵͳ
      ÕâÊÇÊý¾Ý¿â¿Î³ÌÉè¼ÆµÄ³É¹û£¬ËäÈ»³É¼¨²»¼Ñ£¬µ«ÊÇ×÷ΪÎÒÓÃVC++ ÒÔÀ´±àдµÄ×î´ó³ÌÐò»¹ÊÇ´«µ½ÍøÉÏ£¬ÒÔ¹©²Î¿¼¡£ÓÃVC++ ×öÊý¾Ý¿âÉè¼Æ²¢²»ÈÝÒ×£¬µ«Ò²²»ÊDz»¿ÉÄÜ¡£ÒÔÏÂÊÇÎҵijÌÐò½çÃ棬ºóÃæ ......

DateDiff: SQL serverº¯Êý

 ·µ»Ø Variant (Long) µÄÖµ£¬±íʾÁ½¸öÖ¸¶¨ÈÕÆÚ¼äµÄʱ¼ä¼ä¸ôÊýÄ¿¡£
¡¡¡¡Óï·¨
¡¡¡¡DateDiff(interval, date1, date2[, firstdayofweek[, firstweekofyear]])
¡¡¡¡DateDiff º¯ÊýÓï·¨ÖÐÓÐÏÂÁÐÃüÃû²ÎÊý£º
¡¡¡¡²¿·Ö ÃèÊö
¡¡¡¡interval ±ØÒª¡£×Ö·û´®±í´ïʽ£¬±íʾÓÃÀ´¼ÆËãdate1 ºÍ date2 µÄʱ¼ä²îµÄʱ¼ä¼ä¸ô
¡¡¡¡Date1 ......

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
  fr ......

SQL SERVERÈçºÎ¼õÉÙËÀËø

 Ö÷ÒªÕë¶ÔSQL ServerÊý¾Ý¿âËÀËøÏÖÏóµÄÔ¤·À¼°½â¾ö´ëÊ©½øÐÐÁËÏêϸµÄ½éÉÜ£¬¸ü¶àÄÚÈÝÇë´ó¼Ò²Î¿¼ÏÂÎÄ£º
¡¡¡¡ËÀËøÊÇÖ¸ÔÚij×é×ÊÔ´ÖУ¬Á½¸ö»òÁ½¸öÒÔÉϵÄÏß³ÌÔÚÖ´Ðйý³ÌÖУ¬ÔÚÕù¶áijһ×ÊԴʱ¶øÔì³É»¥ÏàµÈ´ýµÄÏÖÏó£¬ÈôÎÞÍâÁ¦µÄ×÷ÓÃÏÂ,ËüÃǶ¼½«ÎÞ·¨ÍƽøÏÂÈ¥£¬ËÀʱ¾Í¿ÉÄÜ»á²úÉúËÀËø,ÕâЩÓÀÔ¶ÔÚ»¥ÏàµÈ´ýµÄ½ø³Ì³ÆΪËÀËøÏ̡߳£¼òµ¥µ ......

¹ØÓÚSQLÓï¾ä

½ñÌìдÍøÕ¾µÄʱºòºÜ囧°¡£¬·¢ÏÖ²éÕÒÓû§È¨ÏÞµÄʱºòÎÞÔµÎ޹ʵÄͬһ¸öȨÏÞÖظ´³öÏֺܶà´Î
Ð޸ĺóµÄSQLÓï¾äÈçÏÂ
SELECT
node
.
id
,
node
.
name
,
access
.
role_id
from
think_role_user
AS
user
,
think_access
AS
access
,
think_node
AS
node
WHERE
user
.
user_id
=
......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ