SqlServer´æ´¢½á¹¹ÓëÒ»¸öË÷ÒýÎÊÌâ
SQL code:
CREATE TABLE TUser
(
FName CHAR(8000),
FAge INT,
FSex bit
)
INSERT INTO TUser
SELECT 'ÕÅÈý',18,1
UNION ALL
SELECT 'ÀîËÄ',20,1
UNION ALL
SELECT 'ÍõÎå',32,1
UNION ALL
SELECT 'Âé×Ó',23,1
²é¿´IOʹÓÃÇé¿ö
SQL code:
SET STATISTICS IO ON
SELECT * from TUser
(4 ÐÐÊÜÓ°Ïì)
±í 'TUser'¡£É¨Ãè¼ÆÊý 1£¬Âß¼¶ÁÈ¡ 4 ´Î£¬ÎïÀí¶ÁÈ¡ 0 ´Î£¬Ô¤¶Á 0 ´Î£¬lob Âß¼¶ÁÈ¡ 0 ´Î£¬lob ÎïÀí¶ÁÈ¡ 0 ´Î£¬lob Ô¤¶Á 0 ´Î¡£
Âß¼¶ÁÈ¡4´Î£¬¶ÁÁË4¸öÊý¾ÝPage,È»ºóÎÒÔٲ鿴ʹÓÿռä
SQL code:
EXEC sp_spaceused N'TUser'
dateΪ32K index_size Ϊ8k
µ«ÎÒ¶¼Ã»½¨Á¢Ë÷Òý,Ϊʲô»áÏÈ·ÖÅä8k
ÎÒÓÖ½¨Á¢Ë÷Òý
SQL code:
CREATE INDEX idx_age ON TUser(FAge)
È»ºóÔٲ鿴index_sizeΪ24K
ʹÓÃÏÂÃæ²éѯ£¬ÎÒ¿´ÁËÖ´ÐÐûÓÐÀûÓÃË÷ÒýɨÃè,ÊDZíɨÃè
SQL code:
SELECT * from TUser WHERE FAge=20
ÓÚÒÔÉÏÎÊÌ⣬ÄÄλ°ïÎÒ½â´ðÏ°ɣ¬ÑÏÖظ
Ïà¹ØÎÊ´ð£º
±ÈÈçsqlÓï¾äÊÇ£º
SQL code:
select top 300
CA01.A_id as '±ä¶¯´ÎÊý',
CA01.A0188 as 'ÈËÔ±id',
CA01.apname as 'ÉóÅúÕß',
CA01.CA0100 as 'È·ÈÏ״̬',
CA01.CA0101 as '±ä¶¯ÀàÐÍ',
CA01.CA0102 as 'Éê ......
ÏÖÒ»·þÎñÆ÷£¬Ö§³ÖRAID5/RAID1+0µÈ£¬ÓÐ4¿éÒ»ÑùÐͺŵÄÓ²ÅÌ£¬°²×°ÁËRAID¿¨¡£
ÎÒËÑË÷ÁËÂÛ̳£¬ÓÐ˵Ҫ°ÑÊý¾Ý¿âÎļþ·Ö²¼ÔÚ²»Í¬´ÅÅÌ£¬µ«ÊÇ£¬×öraid5»òraid10ºó£¬4¿éÓ²Å̺ÃÏñ³ÉΪһÌåÁË£¬ÎÒ·Ö3¸ö·ÖÇø£¬Îļþ·Ö²¼ÔÚ²»Í¬· ......
ÄÜ·ñÓÃÓï¾äʵÏÖ¡£¶ø²»ÊÇÏֳɵŤ¾ß£¿
Â¥ÉϵÄÐֵܿÉÒÔÏêϸһЩÂð£¿
×£Äã½ÚÈÕ¿ìÀÖ£¡¹þ¹þ
½ÚÈÕ¿ìÀÖ
SQL code:
Ò». µ¼³ö¹¤¾ß exp
1. ËüÊDzÙ×÷ϵͳÏÂÒ»¸ö¿ÉÖ´ÐеÄÎļþ ´æ·ÅĿ¼/ORACLE_HOME/bin
......
ÔÊý¾Ý£º
¾¹ý´ËsqlÓï¾ä²éѯ³öÀ´µÄ½á¹ûÊÇ£º
SQL code:
select Code, Name=stuff((select ','+Name from C t where Code=C.Code for xml path('')), 1, 1, '')
from C
¼ÓÉÏG ......