sqlÓï¾äÓÅ»¯30Àý×Ó
ÔÚ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 SAL<5000000 AND HIREDATE<SYSDATE;
11. /*+INDEX_JOIN(TABLE INDEX_NAME)*/
ÌáʾÃ÷È·ÃüÁîÓÅ»¯Æ÷ʹÓÃË÷Òý×÷Ϊ·
Ïà¹ØÎĵµ£º
ʹÓÃSQL SERVER2005µÄʱºòÓöµ½ÁËÖÐÎÄ×Ö·ûΪÂÒÂëµÄÇé¿ö£¬¾¹ýÑо¿·¢ÏÖ£¬ÉèÖÃSQLµÄÅÅÐò¹æÔò¿ÉÒÔ½â¾öÕâ¸öÎÊÌâ¡£
1¡¢µÇ¼·þÎñÆ÷´ò¿ªMicrosoft SQL Server Management Studio¡£
2¡¢ÔÚÒªÐ޸ĵÄÊý¾Ý¿âÉϵ¥»÷Êó±êÓÒ¼ü£¬²¢Ñ¡Ôñ“ÊôÐÔ”¡£
3¡¢ÔÚµ¯³öµÄÊý¾Ý¿âÊôÐÔ´°¿ÚÖеã»÷“Ñ¡ÔñÒ³”ÖеēѡÏ£ ......
Æô¶¯Êý¾Ý¿âÓʼþ¹¦ÄÜ
sp_configure 'show advanced', 1;
GO
RECONFIGURE;
GO
sp_configure 'Database Mail XPs', 1;
GO
RECONFIGURE;
GO
-- ÅäÖÃÊý¾Ý¿âÓʼþ
-- Ìí¼ÓÓʼþÕË»§
execute msdb.dbo.sysmail_add_account_sp
@account_name = 'ÓÊÏäÕ ......
н¨Êý¾Ý±íÒÔºó£¬ÈôÔٶԸñí½øÐиü¸Ä£¬Ôò»á³öÏÖ¾¯¸æÐÅÏ¢“²»ÔÊÐí±£´æ¸ü¸Ä ×èÖ¹±£´æÒªÇóÖØд´½¨±íµÄ¸ü¸Ä”£¬µÈµÈ£¬ÐèÒª½øÐÐÒ»ÏÂÉèÖ㺹¤¾ß--->Ñ¡Ïî--->Designers--->±íÉè¼ÆÆ÷ºÍÊý¾Ý¿âÉè¼ÆÆ÷--->×éÖ¯±£´æÒªÇóÖØд´½¨±íµÄ¸ü¸Ä£¬È¥µô¸´Ñ¡¿ò¡£
À´Ô´ÍøÂ磺“²»ÊǺÜÀí½âΪʲôÔÚ2008Öлá¼ÓÈë"×èÖ¹ ......
ÎÊÌ⣺
ÎÒÏÖÔÚÄÚÈݶ¼µ÷ÓóöÀ´ÁË ¾ÍÊÇΨһµÄÒ»¸öÎÊÌâ¡¡¡¡ÎÒÒªµ÷µ±Ç°Óû§ID¡¡ÎÒÓõÄPHPCMS {$r[userid]}Õâ¸ö±äÁ¿ ÔÚSqlServerÉϵ÷Óò»µ½
$sql="SELECT CustomerID, Carid, TotolPoints, TakePoints, LeavingPoints, CarType,Activation,Consumption
fro ......
ÔÚSQL¿ç±í×éºÏ²éѯ´æÔÚЧÂÊÎÊÌ⣬¾ÙÀý±ÈÈç
delete from media_source where movie_id in ( select media_id from media where type=2 ) and origin = 3;
ºÍ
delete from media_source where origin = 3 and movie_id in ( select media_id from media where type=2 );
µÄЧÂÊÊDz»Ò»ÑùµÄ¡£
Èôorigin=3µÄÇé¿öÏÂmedia_so ......