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

SQL Server Ë÷Òý½á¹¹¼°ÆäʹÓã¨Ò»£©

SQL Server Ë÷Òý½á¹¹¼°ÆäʹÓã¨Ò»£©
×÷Õߣºfreedk
Ò»¡¢ÉîÈëdz³öÀí½âË÷Òý½á¹¹
¡¡¡¡Êµ¼ÊÉÏ£¬Äú¿ÉÒÔ°ÑË÷ÒýÀí½âΪһÖÖÌØÊâµÄĿ¼¡£Î¢ÈíµÄSQL SERVERÌṩÁËÁ½ÖÖË÷Òý£º¾Û¼¯Ë÷Òý£¨clustered index£¬Ò²³Æ¾ÛÀàË÷Òý¡¢´Ø¼¯Ë÷Òý£©ºÍ·Ç¾Û¼¯Ë÷Òý£¨nonclustered index£¬Ò²³Æ·Ç¾ÛÀàË÷Òý¡¢·Ç´Ø¼¯Ë÷Òý£©¡£ÏÂÃ棬ÎÒÃǾÙÀýÀ´ËµÃ÷һϾۼ¯Ë÷ÒýºÍ·Ç¾Û¼¯Ë÷ÒýµÄÇø±ð£º
¡¡¡¡Æäʵ£¬ÎÒÃǵĺºÓï×ÖµäµÄÕýÎı¾Éí¾ÍÊÇÒ»¸ö¾Û¼¯Ë÷Òý¡£±ÈÈ磬ÎÒÃÇÒª²é“°²”×Ö£¬¾Í»áºÜ×ÔÈ»µØ·­¿ª×ÖµäµÄÇ°¼¸Ò³£¬ÒòΪ“°²”µÄÆ´ÒôÊÇ“an”£¬¶ø°´ÕÕÆ´ÒôÅÅÐòºº×ÖµÄ×ÖµäÊÇÒÔÓ¢ÎÄ×Öĸ“a”¿ªÍ·²¢ÒÔ“z”½áβµÄ£¬ÄÇô“°²”×Ö¾Í×ÔÈ»µØÅÅÔÚ×ÖµäµÄÇ°²¿¡£Èç¹ûÄú·­ÍêÁËËùÓÐÒÔ“a”¿ªÍ·µÄ²¿·ÖÈÔÈ»ÕÒ²»µ½Õâ¸ö×Ö£¬ÄÇô¾Í˵Ã÷ÄúµÄ×ÖµäÖÐûÓÐÕâ¸ö×Ö£»Í¬ÑùµÄ£¬Èç¹û²é“ÕÅ”×Ö£¬ÄÇÄúÒ²»á½«ÄúµÄ×ֵ䷭µ½×îºó²¿·Ö£¬ÒòΪ“ÕÅ”µÄÆ´ÒôÊÇ“zhang”¡£Ò²¾ÍÊÇ˵£¬×ÖµäµÄÕýÎIJ¿·Ö±¾Éí¾ÍÊÇÒ»¸öĿ¼£¬Äú²»ÐèÒªÔÙÈ¥²éÆäËûĿ¼À´ÕÒµ½ÄúÐèÒªÕÒµÄÄÚÈÝ¡£ÎÒÃÇ°ÑÕâÖÖÕýÎÄÄÚÈݱ¾Éí¾ÍÊÇÒ»ÖÖ°´ÕÕÒ»¶¨¹æÔòÅÅÁеÄĿ¼³ÆΪ“¾Û¼¯Ë÷Òý”¡£
¡¡¡¡Èç¹ûÄúÈÏʶij¸ö×Ö£¬Äú¿ÉÒÔ¿ìËٵشÓ×Ô¶¯Öв鵽Õâ¸ö×Ö¡£µ«ÄúÒ²¿ÉÄÜ»áÓöµ½Äú²»ÈÏʶµÄ×Ö£¬²»ÖªµÀËüµÄ·¢Òô£¬Õâʱºò£¬Äú¾Í²»ÄÜ°´Õողŵķ½·¨ÕÒµ½ÄúÒª²éµÄ×Ö£¬¶øÐèҪȥ¸ù¾Ý“Æ«ÅÔ²¿Ê×”²éµ½ÄúÒªÕÒµÄ×Ö£¬È»ºó¸ù¾ÝÕâ¸ö×ÖºóµÄÒ³ÂëÖ±½Ó·­µ½Ä³Ò³À´ÕÒµ½ÄúÒªÕÒµÄ×Ö¡£µ«Äú½áºÏ“²¿Ê×Ŀ¼”ºÍ“¼ì×ֱ픶ø²éµ½µÄ×ÖµÄÅÅÐò²¢²»ÊÇÕæÕýµÄÕýÎĵÄÅÅÐò·½·¨£¬±ÈÈçÄú²é“ÕÅ”×Ö£¬ÎÒÃÇ¿ÉÒÔ¿´µ½Ôڲ鲿Ê×Ö®ºóµÄ¼ì×Ö±íÖГÕÅ”µÄÒ³ÂëÊÇ672Ò³£¬¼ì×Ö±íÖГÕÅ”µÄÉÏÃæÊÇ“³Û”×Ö£¬µ«Ò³ÂëÈ´ÊÇ63Ò³£¬“ÕÅ”µÄÏÂÃæÊÇ“åó”×Ö£¬Ò³ÃæÊÇ390Ò³¡£ºÜÏÔÈ»£¬ÕâЩ×Ö²¢²»ÊÇÕæÕýµÄ·Ö±ðλÓÚ“ÕÅ”×ÖµÄÉÏÏ·½£¬ÏÖÔÚÄú¿´µ½µÄÁ¬ÐøµÄ“³Û¡¢ÕÅ¡¢åó”Èý×Öʵ¼ÊÉϾÍÊÇËûÃÇÔڷǾۼ¯Ë÷ÒýÖеÄÅÅÐò£¬ÊÇ×ÖµäÕýÎÄÖеÄ×ÖÔڷǾۼ¯Ë÷ÒýÖеÄÓ³Éä¡£ÎÒÃÇ¿ÉÒÔͨ¹ýÕâÖÖ·½Ê½À´ÕÒµ½ÄúËùÐèÒªµÄ×Ö£¬µ«ËüÐèÒªÁ½¸ö¹ý³Ì£¬ÏÈÕÒµ½Ä¿Â¼ÖеĽá¹û£¬È»ºóÔÙ·­µ½ÄúËùÐèÒªµÄÒ³Âë¡£ÎÒÃÇ°ÑÕâÖÖĿ¼´¿´âÊÇĿ¼£¬ÕýÎÄ´¿´âÊÇÕýÎĵÄÅÅÐò·½Ê½³ÆΪ“·Ç¾Û¼¯Ë÷Òý”¡£
¡¡¡¡Í¨¹ýÒÔÉÏÀý×Ó£¬ÎÒÃÇ¿ÉÒÔÀí½âµ½Ê²Ã´ÊÇ“¾Û¼¯Ë÷Òý”ºÍ“·Ç¾Û¼¯Ë÷


Ïà¹ØÎĵµ£º

SQLº¯Êý´óÈ«

¾ÛºÏº¯Êý
MAX(×Ö¶Î)      
Çóij×Ö¶ÎÖеÄ×î´óÖµ
MIN(×Ö¶Î)
    
Çóij×Ö¶ÎÖеÄ×îСֵ
AVG(×Ö¶Î)
     
Çóij×Ö¶ÎÖеÄƽ¾ùÖµ
SUM(×Ö¶Î)
    
Çóij×Ö¶ÎÖеÄ×ܺÍ
COUNT(×Ö¶Î) 
ͳ¼Æij×ֶηǿռͼÊý
COUNT
......

hibernateÖ´ÐÐÔ­ÉúSqlÓï¾äµÄ·½·¨£¨×ª£©

http://www.thecloud.cn/study/program/java/597.html
hibernate3µÄHQL ÊÇÃæÏò¶ÔÏóµÄÓï·¨,ÒѾ­Ö§³Ö update ,delete fromÓï¾ä,µ«
Ä¿Ç°»¹²»Ö§³Öinsert intoÓï¾ä.
×öÏîÄ¿ÓÐʱºòµÄÈ·ÐèҪдԭÉúµÄsqlÀ´·½±ãweb¿ª·¢.
ÏÂÃæÊÇÎÒ×Ô¼º¹Äµ·³öÀ´µÄ·½·¨,Ï£Íû¶ÔÎÒºÍÅóÓÑÓÐËù°ïÖú.
ÔÚDaoÀïдһ¸ö·½·¨,ÈÃÎÒÃÇÔÚactionÀïµ÷ÓÃËü...
&nbs ......

select sql Óï¾äÖ´Ðйý³Ì ˳Ðò


(
8)
SELECT
(
9)
DISTINCT
(
11)
<
TOP_specification>
<
select_list>
(
1)
from
<
left_table>
(
3)
<
join_type>
JOIN
<
right_table>
(
2)
ON
<
join_codition>
(
4)
WHERE
<
where_condition>
(
5)
GROUP
BY
& ......

½«excelÎļþÖеÄÊý¾Ýµ¼Èëµ¼³öÖÁSQLÊý¾Ý¿âÖÐ

µ¼Èë
Èç¹û±íÒÑ´æÔÚ£¬SQLÓï¾äΪ£º
insert into aa select * from OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0',
'Data Source=D:\OutData.xls;Extended Properties=Excel 8.0')...[sheet1$]
ÆäÖУ¬aaÊDZíÃû£¬D:\OutData.xlsÊÇexcelµÄȫ·¾¶ sheet1ºó±ØÐë¼ÓÉÏ$
Èç¹û±í²»´æÔÚ£¬SQLÓï¾äΪ£º
SELECT * INTO aa from OPENDAT ......

SQL Server·þÎñÆ÷Ãû³ÆÓëĬÈÏʵÀýÃû²»Ò»ÖµÄÐÞ¸´·½·¨

Ô­Òò·ÖÎö:
SERVERPROPERTY º¯ÊýµÄ ServerName ÊôÐÔÓë@@SERVERNAME ·µ»ØÏàËƵÄÐÅÏ¢¡£ServerName ÊôÐÔÌṩWindows ·þÎñÆ÷ºÍʵÀýÃû³Æ£¬Á½Õß¹²Í¬¹¹³ÉΨһµÄ·þÎñÆ÷ʵÀý£»@@SERVERNAME Ìṩµ±Ç°ÅäÖõı¾µØ·þÎñÆ÷Ãû³Æ¡£
Èç¹û°²×°Ê±Î´¸ü¸ÄĬÈÏ·þÎñÆ÷Ãû³Æ£¬Ôò ServerName ÊôÐÔºÍ @@SERVERNAME ·µ»ØÏàͬµÄÐÅÏ¢¡£Èç¹ûÔÚ°²×°Ê±Òѽ«±¾µ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ