³£¼ûOracle HINTµÄÓ÷¨ SQLÓÅ»¯
ÔÚSQLÓï¾äÓÅ»¯¹ý³ÌÖУ¬ÎÒÃǾ³£»áÓõ½hint,ÏÖ×ܽáÒ»ÏÂÔÚSQLÓÅ»¯¹ý³ÌÖг£¼ûOracle HINTµÄÓ÷¨£º
1. /*+ALL_ROWS*/
±íÃ÷¶ÔÓï¾ä¿éÑ¡Ôñ»ùÓÚ¿ªÏúµÄÓÅ»¯·½·¨,²¢»ñµÃ×î¼ÑÍÌÍÂÁ¿,ʹ×ÊÔ´ÏûºÄ×îС»¯.
ÀýÈç:
SELECT /*+ALL+_ROWS*/ EMP_NO,EMP_NAM,DAT_IN from BSEMPMS WHERE EMP_NO=’SCOTT’;
2. /*+FIRST_ROWS*/
±íÃ÷¶ÔÓï¾ä¿éÑ¡Ôñ»ùÓÚ¿ªÏúµÄÓÅ»¯·½·¨,²¢»ñµÃ×î¼ÑÏìӦʱ¼ä,ʹ×ÊÔ´ÏûºÄ×îС»¯.
ÀýÈç:
SELECT /*+FIRST_ROWS*/ EMP_NO,EMP_NAM,DAT_IN from BSEMPMS WHERE EMP_NO=’SCOTT’;
3. /*+CHOOSE*/
±íÃ÷Èç¹ûÊý¾Ý×ÖµäÖÐÓзÃÎʱíµÄͳ¼ÆÐÅÏ¢,½«»ùÓÚ¿ªÏúµÄÓÅ»¯·½·¨,²¢»ñµÃ×î¼ÑµÄÍÌÍÂÁ¿;
±íÃ÷Èç¹ûÊý¾Ý×ÖµäÖÐûÓзÃÎʱíµÄͳ¼ÆÐÅÏ¢,½«»ùÓÚ¹æÔò¿ªÏúµÄÓÅ»¯·½·¨;
ÀýÈç:
SELECT /*+CHOOSE*/ EMP_NO,EMP_NAM,DAT_IN from BSEMPMS WHERE EMP_NO=’SCOTT’;
4. /*+RULE*/
±íÃ÷¶ÔÓï¾ä¿éÑ¡Ôñ»ùÓÚ¹æÔòµÄÓÅ»¯·½·¨.
ÀýÈç:
SELECT /*+ RULE */ EMP_NO,EMP_NAM,DAT_IN from BSEMPMS WHERE EMP_NO=’SCOTT’;
5. /*+FULL(TABLE)*/
±íÃ÷¶Ô±íÑ¡ÔñÈ«¾ÖɨÃèµÄ·½·¨.
ÀýÈç:
SELECT /*+FULL(A)*/ EMP_NO,EMP_NAM from BSEMPMS A WHERE EMP_NO=’SCOTT’;
6. /*+ROWID(TABLE)*/
ÌáʾÃ÷È·±íÃ÷¶ÔÖ¸¶¨±í¸ù¾ÝROWID½øÐзÃÎÊ.
ÀýÈç:
SELECT /*+ROWID(BSEMPMS)*/ * from BSEMPMS WHERE ROWID>=’AAAAAAAAAAAAAA’
AND EMP_NO=’SCOTT’;
7. /*+CLUSTER(TABLE)*/
ÌáʾÃ÷È·±íÃ÷¶ÔÖ¸¶¨±íÑ¡Ôñ´ØɨÃèµÄ·ÃÎÊ·½·¨,ËüÖ»¶Ô´Ø¶ÔÏóÓÐЧ.
ÀýÈç:
SELECT /*+CLUSTER */ BSEMPMS.EMP_NO,DPT_NO from BSEMPMS,BSDPTMS
WHERE DPT_NO=’TEC304′ AND BSEMPMS.DPT_NO=BSDPTMS.DPT_NO;
8. /*+INDEX(TABLE INDEX_NAME)*/
±íÃ÷¶Ô±íÑ¡ÔñË÷ÒýµÄɨÃè·½·¨.
ÀýÈç:
SELECT /*+INDEX(BSEMPMS SEX_INDEX) USE SEX_INDEX BECAUSE THERE ARE FEWMALE BSEMPMS */ from BSEMPMS WHERE SEX=’M';
9. /*+INDEX_ASC(TABLE INDEX_NAME)*/
±íÃ÷¶Ô±íÑ¡ÔñË÷ÒýÉýÐòµÄɨÃè·½·¨.
ÀýÈç:
SELECT /*+INDEX_ASC(BSEMPMS PK_BSEMPMS) */ from BSEMPMS WHERE DPT_NO=’SCOTT’;
10. /*+INDEX_COMBINE*/
Ϊָ¶¨±íÑ¡Ôñλͼ·ÃÎÊ·¾,Èç¹ûINDEX_COMBINEÖÐûÓÐÌṩ×÷Ϊ²ÎÊýµÄË÷Òý,½«Ñ¡Ôñ³öλͼË÷ÒýµÄ²¼¶û×éºÏ·½Ê½.
ÀýÈç:
SELECT /*+INDEX_COMBINE(BSEMPMS SAL_BMI HIREDATE_BMI)*/ * from BSEMPMS
WHERE
Ïà¹ØÎĵµ£º
¸Ãº¯ÊýÓÃÀ´·µ»ØÒ»¸öËÄÉáÎåÈëºóµÄÖµ
SELECT ROUND( number, [ decimalplaces ] ) from DUAL
參數:
±ØÌîÏnumber : Òª´¦ÀíµÄÊýÖµ(ÊýÖµ±í´ïʽ)
¿ÉÑ¡Ïdecimalplaces : ËÄÉáÎåÈëʱȡµÄСÊýµÄλÊý£¬²»ÌîÔò·µ»ØÕûÊý
Sample :
select round(123.456) from dual;& ......
Oracle ÏòÒ»¸ö±íÖвåÈëÊý¾ÝµÄÁ½ÖÖ·½Ê½£º
Conventional Insert Operations£º´«Í³²åÈë»áÓÅÏÈʹÓøßˮλ֮Ï£¬»á±£Ö¤Êý¾ÝÓ¦ÓÃÍêÕûÐÔ£º¸ßˮλ֮ÏÂÊÇÖ¸£ºÉ¾³ýÖ®ºóµÄÊ£Óà¿Õ¼ä£¬¸ßˮλ֮ÉÏÊÇÖ¸£º´ÓÀ´Ã»ÓÐÓùýµÄ´¦Å®¿é¡£
Direct-path Insert Operatio ......
¡¡1. ²é¿´Êý¾Ý¿âµÄ°æ±¾
¡¡¡¡select @@version
¡¡¡¡³£¼ûµÄ¼¸ÖÖSQL SERVER´ò²¹¶¡ºóµÄ°æ±¾ºÅ:
¡¡¡¡8.00.194 Microsoft SQL Server 2000
¡¡¡¡8.00.384 Microsoft SQL Server 2000 SP1
¡¡¡¡8.00.532 Microsoft SQL Server 2000 SP2
¡¡¡¡8.00.760 Microsoft SQL Server 2000 SP3
¡¡¡¡8.00.818 Microsoft SQL ......
ÕýÔÚ¼ÓÔØÊý¾Ý...
¡¡¡¡1.°´ÐÕÊϱʻÅÅÐò: select * from TableName Order By CustomerName Collate Chinese_PRC_Stroke_ci_as
¡¡¡¡2.Êý¾Ý¿â¼ÓÃÜ: select encrypt(’ÔʼÃÜÂë’) select pwdencrypt(’ÔʼÃÜÂë’) select pwdcompare(’ÔʼÃÜÂë’,’¼ÓÃܺóÃÜÂë’) = 1--Ïàͬ£»·ñÔ ......
This is very common request recently – How to import CSV file into SQL Server? How to load CSV file into SQL Server Database Table? How to load comma delimited file into SQL Server? Let us see the solution in quick steps.
CSV stands for Comma Separated Values, sometimes also called Co ......