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

SQL¸ß¼¶Ê¹ÓÃÊý¾Ý¿â

SQL¸ß¼¶Ê¹ÓÃ
SELECT¸ß¼¶²éѯ
´íÎó´¦Àí
ÊÂÎñ´¦Àí
Êý¾ÝµÄËø¶¨
Óαê
1.SELECT¸ß¼¶²éѯ
Ç°ÃæÒѾ­½éÉÜÁËSELECTÓï¾äµÄÓ÷¨£¬±¾½ÚÖ÷Òª½éÉÜÊý¾Ý»ã×Ü¡¢Áª½Ó²éѯ¡¢×Ó²éѯºÍ¹Ø¼ü´ÊUNIONµÄʹÓá£
(1)Êý¾Ý»ã×Ü
Ϊ¾ö²ßÖ§³ÖϵͳÉú³É¾ÛºÏÊÂÎñµÄ»ã×ܱ¨±íÊÇÒ»ÏÔÓ²¢ÇÒÏ൱ÏûºÄ×ÊÔ´µÄ¹¤×÷¡£SQL Server 2000ÌṩÁ½¸öÁé»îÇÒÇ¿´óµÄ×é¼þ£¬ÓÃÓÚÉú³ÉSQL Server 2000 Analysis Services¡£ÕâЩ×é¼þÊdzÌÐòÔ±ÔÚÖ´ÐÐSQL ServerÊý¾ÝµÄ¶àά·ÖÎöʱӦµ±Ê¹ÓõÄÖ÷Òª¹¤¾ß¡£ÕâÁ½¸ö×é¼þΪ£º
Êý¾Ýת»»·þÎñ(DTS)¡£DTSÖ§³ÖÌáÈ¡ÊÂÎñÊý¾Ý²¢½«ÕâЩÊý¾Ýת»»µ½Êý¾Ý²Ö¿â»òÊý¾Ý¼¯ºÏÖеĻã×ܾۺÏÖС£
MS SQL Server Analysis Services¡£Õâ×é×é¼þ½«Êý¾Ý²Ö¿âÖеÄÊý¾Ý×éÖ¯µ½º¬ÓÐÔ¤ÏȼÆËãºÃµÄ»ã×ÜÐÅÏ¢µÄ¶àάÊý¾Ý¼¯ÖУ¬ÒÔ¶Ô¸´ÔӵķÖÎö²éѯÌṩ¿ìËÙÏìÓ¦¡£Analysis Services»¹ÌṩһÌ×Ïòµ¼£¬ÓÃÓÚ¶¨Òå·ÖÎö´¦Àí¹ý³ÌÖÐËùÓõĶàά½á¹¹£¬²¢ÌṩÓÃÓÚ¹ÜÀí·ÖÎö½á¹¹µÄMicrosoft¹ÜÀí¿ØÖÆ̨¹ÜÀíµ¥Ôª¡£
µ«ÊǶÔÓÚÉú³É¼òµ¥»ã×ܱ¨±íµÄÓ¦ÓóÌÐò£¬¿ÉʹÓÃÏÂÁÐT-SQLÔªËØ£º
CUBE»òROLLUPÔËËã·û¡£ÕâÁ½Õß¾ùÊÇSELECTÓï¾äµÄGROUP BY×Ó¾äµÄÒ»²¿·Ö¡£
COMPUTE»òCOMPUTE BYÔËËã·û¡£ÕâÁ½ÕßÒ²ÓëGROUP BYÏà¹ØÁª¡£
ÏÂÃæ½éÉÜʹÓÃÉú³É»ã×ܱ¨±íµÄÓï¾ä¡£
a.¾ÛºÏº¯Êý
Êý¾Ý¿âµÄÒ»¸ö×î´óµÄÌصãÊǽ«¸÷ÖÖ·ÖÉ¢µÄÊý¾Ý°´ÕÕÒ»¶¨¹æÂÉ¡¢Ìõ¼þ½øÐзÖÀà×éºÏ£¬×îºóµÃ³öͳ¼Æ½á¹û¡£SQL ServerÌṩÁ˾ۺϺ¯Êý£¬ÓÃÓÚÍê³ÉÒ»¶¨µÄͳ¼Æ¹¦ÄÜ¡£³£Óõĺ¯ÊýÈçÏÂ±í£º
AVG£ºÇóƽ¾ùÖµ
COUNT£º·µ»Ø×éÖÐÏîÄ¿µÄÊýÁ¿£¬·µ»ØֵΪintÀàÐÍ
COUNT_GIG£º·µ»Ø×éÖÐÏîÄ¿µÄÊýÁ¿£¬·µ»ØֵΪbigintÀàÐÍ
MAX£ºÇó×î´óÖµ
MIN£ºÇó×îСֵ
SUM£ºÇóºÍ
STDEV£º¼ÆËãͳ¼Æ±ê׼ƫ²î
VAR£ºÍ³¼Æ·½²î
VARP: Ìî³äͳ¼Æ·½²î
¾ÛºÏº¯Êý¶ÔÒ»×éÖµ¼ÆËã²¢·µ»Øµ¥Ò»µÄÖµ¡£³ýCOUNTÍ⣬¾ÛºÏº¯ÊýºöÂÔ¿ÕÖµ¡£¾ÛºÏº¯Êý½öÔÚÏÂÁÐÏîÖÐÔÊÐí×÷Ϊ±í´ïʽʹÓãº
SELECTÓï¾äµÄÑ¡ÔñÁбí(×Ó²éѯ»òÍⲿ²éѯ)
COMPUTE»òCOMPUTE BY×Ó¾ä
HAVING×Ó¾ä
È磺
USE bookdb
GO
SELECT COUNT(address) from authors
GO
Ö´Ðнá¹û£º2
USE bookdb
GO
SELECT MAX(price) from book
GO
Ö´Ðнá¹û£º45.0
b.GROUP BY×Ó¾ä
GROUP BY×Ó¾äÓÃÀ´Îª½á¹û¼¯ÖеÄÿһÐвúÉú¾ÛºÏÖµ£¬¼´¶Ô½á¹û¼¯½øÐзÖ×é¡£Èç¹û¾ÛºÏº¯ÊýûÓÐʹÓôË×Ӿ䣬ÔòֻΪSELECTÓï¾ä±¨¸æÒ»¸ö¾ÛºÏÖµ¡£Ö¸¶¨GROUP BYʱ£¬Ñ¡ÔñÁбíÖÐÈÎÒ»·Ç¾ÛºÏ±í´ïʽÄÚµÄËùÓÐÁж¼Ó¦°üº¬ÔÚGROUP BYÁбíÖУ¬»òÕßGROUP BY±í´ïʽ±ØÐëÓëÑ¡ÔñÁбí±í´ïʽÍêÈ«Æ¥Åä¡


Ïà¹ØÎĵµ£º

sqlÓï¾ä¶à±í²éѯ

ÎÊÌâ¼°ÃèÊö£º
--1.ѧÉú±í
Student(S#,Sname,Sage,Ssex) --S# ѧÉú±àºÅ,Sname ѧÉúÐÕÃû,Sage ³öÉúÄêÔÂ,Ssex ѧÉúÐÔ±ð
--2.¿Î³Ì±í
Course(C#,Cname,T#) --C# --¿Î³Ì±àºÅ,Cname ¿Î³ÌÃû³Æ,T# ½Ìʦ±àºÅ
--3.½Ìʦ±í
Teacher(T#,Tname) --T# ½Ìʦ±àºÅ,Tname ½ÌʦÐÕÃû
--4.³É¼¨±í
SC(S#,C#,score) --S# ѧÉú±àºÅ,C# ¿Î³Ì ......

Oracle SQL Developer¹¤¾ß

ÏÂÔؽâѹÁËOracle SQL Developer¹¤¾ß£¬ÔËÐÐʱ£¬Æô¶¯²»ÁË£¬±¨´íÐÅÏ¢ÈçÏ£º
---------------------------
Unable to create an instance of the Java Virtual Machine
Located at path:
<SQLDEVELOPER>\jdk\jre\bin\client\jvm.dll
---------------------------
ÊÇJVM²ÎÊýÉèÖõÄÎÊÌ⣬ÎҵĽâ¾ö·½°¸ÈçÏ£º
<SQ ......

SQL SERVER 2008 ¸ü¸Ä¸ú×Ù

SQL SERVER 2008 ¸ü¸Ä¸ú×Ù
/*
¿´Ê飬¿´Áª»úÆڼ䡣¡£¡£Ë³´ø°Ñ¿´µ½µÄдÏÂ
 
ÓëSQL SERVER 2008 CDC Òì²½²¶»ñÊý¾Ý±ä¸üµÄ²»Í¬,¸ü¸Ä¸ú×ÙÊÇͬ²½½ø³Ì,
ÊÇDML(INSERT/UPDATE/DELETE)ÊÂÎñµÄÒ»²¿·Ö,Ëü¿ÉÒÔʹÓÃ×îСµÄCÅÌ´æ´¢
¿ªÏúÀ´Õì²âÊý¾ÝÐеľ»±ä¸ü.ÄÇôËüÒ²¾Í²»ÄÜÏñCDCÄÇÑù¿ÉÒÔÌṩÓû§±íµÄ
ÀúÊ·¸ü¸ÄÐÅÏ¢. ¸ü¸ÄÊÇʹÓÃÒ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ