SQL Server2005ËĸöÅÅÐòº¯Êý¼ò½é
ÅÅÃûº¯ÊýÊÇSQL Server2005мӵŦÄÜ¡£ÔÚSQL Server2005ÖÐÓÐÈçÏÂËĸöÅÅÃûº¯Êý£º
1. row_number ×Ô¶¯Éú³ÉÐкÅ,ÐòºÅÓÉorder by ×ֶξö¶¨
2. rank over Filed, ÓÉrank overµÄ×ֶξö¶¨£¬Ãû´Î²»Á¬Ðø£¬ÈçÓÐ3¸ö²¢ÁеÚÒ»Ãû£¬ÔòºóÐøÃû´ÎÖ±½Ó´Ó4¿ªÊ¼
3. dense_rank£¬ºÍrankÏàËÆ£¬Ö»ÊÇÃû´ÎÁ¬Ðø£¬ÈçÓÐ3¸ö²¢ÁеÚÒ»Ãû£¬ÔòºóÐøÃû´Î´Ó2¿ªÊ¼
4. ntile Ìṩ¾ùÔÈ·Ö×éµÄÅÅÐòº¯Êý£¬º¯Êý²ÎÊýΪ·Ö×éµÄ¸öÊý£¬ÈçÓÐ10Ìõ¼Ç¼·µ»Ø£¬ntile²ÎÊýÖ¸¶¨Îª4£¬Ôò¸÷×é¼Ç¼ÊýÈçÏÂ
1£¨3£©£¬2£¨3£©£¬3£¨2£©£¬4£¨2£©
select
ntile(4) over(order by object_ID) as bucket,name from ( select top 10 * from sys.objects) x
bucket Name
-------------------- --------------------------------------------------------------------------------------------------------------------------------
1 sysrowsetcolumns
1 sysrowsets
1 sysallocunits
2 sysfiles1
2 syshobtcolumns
2 syshobts
3 sysftinds
3 sysserefs
4 sysowners
4 sysdbreg
Ïà¹ØÎĵµ£º
°æȨÉùÃ÷£ºÔ´´×÷Æ·£¬ÈçÐèתÔØ£¬ÇëÓë×÷ÕßÁªÏµ¡£·ñÔò½«×·¾¿·¨ÂÉÔðÈΡ£
DB2ÁÙʱ±íÔÚSQL¹ý³ÌºÍSQLÓï¾äÖеIJâÊÔ×ܽá
²âÊÔÄ¿±ê£º
·Ö±ðÔÚSQL¹ý³ÌºÍSQLÓï¾äÖд´½¨ÁÙʱ±í£¬²¢²åÈëÊý¾Ý£¬¿´Ö´Ðнá¹ûÓÐʲôÒìͬ¡£
²âÊÔ»·¾³£º
DB2 UDB V9.1
Ö´Ðи½¼þÀïÃæµÄSQLÓï¾ä£¬µÃµ½Ò»¸ö±í¡ ......
1¡¢Î½´Ê ν´ÊÔÊÐíÄú¹¹ÔìÌõ¼þ£¬ÒÔ±ãÖ»´¦ÀíÂú×ãÕâЩÌõ¼þµÄÄÇЩÐС£
2¡¢Ê¹Óà IN ν´Ê
ʹÓà IN ν´Ê½«Ò»¸öÖµÓëÆäËû¼¸¸öÖµ½øÐбȽϡ£ÀýÈ磺
SELECT NAME from STAFF WHERE DEPT IN (20, 15)
´ËʾÀýÏ൱ÓÚ£º
SELECT NAME from STAFF WHERE DEPT = 20 OR DEPT = 15
µ±×Ó²éѯ·µ»ØÒ»×éֵʱ£¬¿ÉʹÓà IN ºÍ NOT IN ÔËËã·û¡£ÀýÈç£ ......
Ìõ¼þ£º
ÓµÓÐsaȨÏÞ
¿ªÆô xp_cmdshell
·½·¨£º
¿ªÆô/¹Ø±Õ xp_cmdshell ±ØÐëÔÚ master ¿âÖ´ÐÐ
EXEC sp_configure 'show advanced options', 1
RECONFIGURE WITH OVERRIDE
EXEC sp_configure 'xp_cmdshell', 1
RECONFIGURE ......
1 PLS_INTEGER
PLS_INTEGER¿ÉÒÔ´æ´¢Ò»¸öÓзûºÅµÄÕûÐÎÖµ£¬Æ侫¶È·¶Î§ºÍBINARY_INTEGERÒ»Ñù£¬ÊÇ£º-2^31~2^31¡£
PLS_INTEGERºÍNUMBER±È½ÏÆðÀ´£¬ÆäÓŵãÊÇ£º
1).Õ¼ÓнÏÉٵĴ洢¿Õ¼ä£»
2).¿ÉÒÔÖ±½Ó½øÐÐËãÊõÔËË㣨ÔÚNUMBERÉϲ»ÄÜÖ±½Ó½øÐÐËãÊõÔËË㣬Èç¹ûÒª¼ÆË㣬NUMBER±ØÐëÏȱ»×ª»»³É¶þ½øÖÆ£©¡£ËùÒÔÔÚ½øÐÐËãÊõµÄʱºòPLS_INTEGER ......
¸ÐлÌ῵µÂÂÞ¼ÓµÄͶµÝ
¾ÍÏñµ±Ä겨ʿ¶ÙµÄ°®¹úÕßΪ·´¿¹Ó¢¹úÖØË°µÄÐж¯Ò»Ñù£¬NoSQLµÄÖ§³ÖÕßÃÇ´Ó¸÷µØÓ¿À´£¬·ÖÏíËûÃÇÈçºÎÍÆ·»ºÂý¶ø°º¹óµÄ¹ØϵÊý¾Ý¿âµÄ±©Õþ£¬ÔõÑùʹÓøüÓÐЧºÍ¸ü±ãÒ˵ķ½·¨À´¹ÜÀíÊý¾Ý£¬ËûÃÇ¿ªÊ¼¶ÔSQL˵²»£¡NoSQL×éÖ¯ÉϸöÔÂÔھɽðɽµÄÐж¯ÈÃÈËÎŵ½ÁËÊý¾Ý¿â¸ïÃüµÄζµÀ£¬ºÃÏñÒ»¸öÏÖ´úITÒµ°æµÄ²¨ ......