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

ÓÃÓÚ·ÖÒ³ÏÔʾµÄSQLÎÄ

Ô­Ö· http://technet.microsoft.com/ja-jp/library/cc411406.aspx
 
¿´ÁËһƪSQL2005¹ØÓÚTransact-SQLµÄÇ¿»¯¼¼ÄܵĽéÉÜ£¬¾õµÃºÜÓÐÓô¦£¬¼òµ¥×ܽáÁËһϡ£
 
£¨Ò»£©Êý¾Ý¿â×ö³É
USE tempdb – »òÕßн¨Ò»¸öDB
CREATE TABLE SpeakerStats
(
  speaker        VARCHAR(10) NOT NULL PRIMARY KEY,
  track          VARCHAR(10) NOT NULL,
  score          INT         NOT NULL,
  pctfilledevals INT         NOT NULL,
  numsessions    INT         NOT NULL
)
 
SET NOCOUNT ON
INSERT INTO SpeakerStats VALUES('Dan',     'Sys', 3, 22, 4)
INSERT INTO SpeakerStats VALUES('Ron',     'Dev', 9, 30, 3)
INSERT INTO SpeakerStats VALUES('Kathy',   'Sys', 8, 27, 2)
INSERT INTO SpeakerStats VALUES('Suzanne', 'DB',  9, 30, 3)
INSERT INTO SpeakerStats VALUES('Joe',     'Dev', 6, 20, 2)
INSERT INTO SpeakerStats VALUES('Robert',  'Dev', 6, 28, 2)
INSERT INTO SpeakerStats VALUES('Mike',    'DB',  8, 20, 3)
INSERT INTO SpeakerStats VALUES('Michele', 'Sys', 8, 31, 4)
INSERT INTO SpeakerStats VALUES('Jessica', 'Dev', 9, 19, 1)
INSERT INTO SpeakerStats VALUES('Brian',   'Sys', 7, 22, 3)
INSERT INTO SpeakerStats VALUES('Kevin',   'DB',  7, 25, 4)
 
£¨¶þ£©
SQL2005ϵÄSQLÓï¾ä£¨1£©ºÍ2000ϵģ¨2£©Ö´Ðнá¹ûÒ»ÖÂ
£¨1£©
SELECT ROW_NUMBER() OVER(ORDER BY score DESC, pctfilledevals DESC,
                           numsessions DESC, speaker) AS rownum,
  speaker, track, score, pctfilledevals, numsessions
from SpeakerStats
ORDER BY score


Ïà¹ØÎĵµ£º

SQL Server ÃæÊÔÌâ

Sql³£¼ûÃæÊÔÌ⣨×ܽᣩ
0.ÈçºÎɾ³ýÒ»¸öÓµÓбȽ϶àµÄÊý¾ÝµÄ±í
Èç¹û¸Ã±íËùÔÚµÄÊý¾Ý¿âÓµÓнÏÉÙµÄ±í£¬¿ÉÒÔÏȽ«ÆäÓà±íµ¼³öÈ¥£¬È»ºó·ÖÀëÊý¾Ý¿â£¬ÔÚɾ³ý£¬Ð½¨Ò»¸öͬÃûÊý¾Ý¿â£¬½«ÆäÓà±íÔٴε¼Èë¡£
1.ÓÃÒ»ÌõSQLÓï¾ä ²éѯ³öÿÃſζ¼´óÓÚ80·ÖµÄѧÉúÐÕÃû  
name kecheng fenshu
ÕÅÈý     ÓïÎÄ  &n ......

SQL PLUS ÃüÁî´óÈ«(ת)

OracleµÄsql*plusÊÇÓëoracle½øÐн»»¥µÄ¿Í»§¶Ë¹¤¾ß¡£ÔÚsql*plusÖУ¬¿ÉÒÔÔËÐÐsql*plusÃüÁîÓësql*plusÓï¾ä¡£
   ÎÒÃÇͨ³£Ëù˵µÄDML¡¢DDL¡¢DCLÓï¾ä¶¼ÊÇsql*plusÓï¾ä£¬ËüÃÇÖ´ÐÐÍêºó£¬¶¼¿ÉÒÔ±£´æÔÚÒ»¸ö±»³ÆÎªsql bufferµÄÄÚ´æÇøÓòÖУ¬²¢ÇÒÖ»Äܱ£´æÒ»Ìõ×î½üÖ´ÐеÄsqlÓï¾ä£¬ÎÒÃÇ¿ÉÒÔ¶Ô±£´æÔÚsql bufferÖеÄsql Óï¾ä½øÐÐ ......

SQL ÈÕÆÚת»»

http://xujunprogrammer.blog.hexun.com/8376520_d.html
SQL ServerÖÐÎİæµÄĬÈϵÄÈÕÆÚ×Ö¶Îdatetime¸ñʽÊÇyyyy-mm-dd Thh:mm:ss.mmm
ÀýÈç:
select getdate()
2004-09-12 11:06:08.177
Õâ¶ÔÓÚÔÚÒª²»Í¬Êý¾Ý¿â¼ä×ªÒÆÊý¾Ý»òÕßϰ¹ßoracleÈÕÆÚ¸ñʽYYYY-MM-DD HH24:MI:SSµÄÈ˶àÉÙÓÐЩ²»·½±ã.
ÎÒÕûÀíÁËÒ»ÏÂSQL ServerÀïÃæ¿ÉÄ ......

SQLʱ¼äÀàÐÍÄ£ºý²éѯ

     Êý¾Ý¿âÀàÐÍΪDateTimeÀàÐÍ£¬½«Æä×öÄ£ºý²éѯʱ£¬ÔÚHibernateÖУ¬¿ÉÒÔÓÃÆ´SQLµÄÎÊÌ⽫Æä½â¾ö£¬¼´ÔÚSQL²éѯ·ÖÎöÆ÷дSQLÒ»Ñù£¬µ«ÊÇÀûÓòÎÊýÅäÖã¬Ôò·½·¨ÈçÏ£º
     1¡¢Æ´ÉÏSQL,È磺
            String beginPara= &q ......

SQL Server 2008ÐÂÌØÐÔ£­Êý¾ÝѹËõ

Êý¾ÝѹËõ£¨Data Compression£©ÊÇSQL Server 2008ÒýÈëµÄÐÂÌØÐÔÖ®Ò»£¬ÕâÏî¼¼ÊõʹÊý¾Ý¸üÓÐЧµÄ±£´æ²¢ÇÒ¼«´ó¼õÉÙÁË´æ´¢¿ªÏú£¬Í¬Ê±Ò²´øÀ´ÁËÐÔÄÜÉϵÄÏÔÖøÌá¸ß£¬ÓÈÆäÊǶÔÐèÒª´óÁ¿´ÅÅÌI/OµÄÊý¾Ý²Ö¿â¡£
 
×¢£ºÆäʵÔÚSQL Server 2005 SP2°æ±¾ÖУ¬ÒѾ­ÒýÈëÁË vardecimal £¬ËüʹÓñ䳤µÄ¸ñʽ´æ´¢¶¨³¤µÄdecimalºÍnumbericÊý¾Ý¡£
......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ