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

SQLÖ´ÐÐ˳Ðò

Ò»¡¢sqlÓï¾äµÄÖ´Ðв½Ö裺
1£©Óï·¨·ÖÎö£¬·ÖÎöÓï¾äµÄÓï·¨ÊÇ·ñ·ûºÏ¹æ·¶£¬ºâÁ¿Óï¾äÖи÷±í´ïʽµÄÒâÒå¡£
2£© ÓïÒå·ÖÎö£¬¼ì²éÓï¾äÖÐÉæ¼°µÄËùÓÐÊý¾Ý¿â¶ÔÏóÊÇ·ñ´æÔÚ£¬ÇÒÓû§ÓÐÏàÓ¦µÄȨÏÞ¡£
3£©ÊÓͼת»»£¬½«Éæ¼°ÊÓͼµÄ²éѯÓï¾äת»»ÎªÏàÓ¦µÄ¶Ô»ù±í²éѯÓï¾ä¡£
4£©±í´ïʽת»»£¬ ½«¸´Ô SQL ±í´ïʽת»»Îª½Ï¼òµ¥µÄµÈЧÁ¬½Ó±í´ïʽ¡£
5£©Ñ¡ÔñÓÅ»¯Æ÷£¬²»Í¬µÄÓÅ»¯Æ÷Ò»°ã²úÉú²»Í¬µÄ“Ö´Ðмƻ®”
6£©Ñ¡ÔñÁ¬½Ó·½Ê½£¬ ORACLE ÓÐÈýÖÖÁ¬½Ó·½Ê½£¬¶Ô¶à±íÁ¬½Ó ORACLE ¿ÉÑ¡ÔñÊʵ±µÄÁ¬½Ó·½Ê½¡£
7£©Ñ¡ÔñÁ¬½Ó˳Ðò£¬ ¶Ô¶à±íÁ¬½Ó ORACLE Ñ¡ÔñÄÄÒ»¶Ô±íÏÈÁ¬½Ó£¬Ñ¡ÔñÕâÁ½±íÖÐÄĸö±í×öΪԴÊý¾Ý±í¡£
8£©Ñ¡ÔñÊý¾ÝµÄËÑË÷·¾¶£¬¸ù¾ÝÒÔÉÏÌõ¼þÑ¡ÔñºÏÊʵÄÊý¾ÝËÑË÷·¾¶£¬ÈçÊÇÑ¡ÓÃÈ«±íËÑË÷»¹ÊÇÀûÓÃË÷Òý»òÊÇÆäËûµÄ·½Ê½¡£
9£©ÔËÐГִÐмƻ®”
¶þ¡¢SQL SelectÓï¾äÍêÕûµÄÖ´ÐÐ˳Ðò£º
1¡¢from×Ó¾ä×é×°À´×Ô²»Í¬Êý¾ÝÔ´µÄÊý¾Ý£»
2¡¢where×Ó¾ä»ùÓÚÖ¸¶¨µÄÌõ¼þ¶Ô¼Ç¼ÐнøÐÐɸѡ£»
3¡¢group by×Ӿ佫Êý¾Ý»®·ÖΪ¶à¸ö·Ö×飻
4¡¢Ê¹Óþۼ¯º¯Êý½øÐмÆË㣻
5¡¢Ê¹ÓÃhaving×Ó¾äɸѡ·Ö×飻
6¡¢¼ÆËãËùÓеıí´ïʽ£»
7¡¢Ê¹ÓÃorder by¶Ô½á¹û¼¯½øÐÐÅÅÐò¡£
Èý¡¢oracle ¹²ÏíÔ­Àí£º
ORACLE½«Ö´ÐйýµÄSQLÓï¾ä´æ·ÅÔÚÄÚ´æµÄ¹²Ïí³Ø(shared buffer pool)ÖУ¬¿ÉÒÔ±»ËùÓеÄÊý¾Ý¿âÓû§¹²Ïí µ±ÄãÖ´ÐÐÒ»¸öSQLÓï¾ä(ÓÐʱ±»³ÆΪһ¸öÓαê)ʱ,Èç¹ûËüºÍ֮ǰµÄÖ´ÐйýµÄÓï¾äÍêÈ«Ïàͬ, ORACLE¾ÍÄܺܿì»ñµÃÒѾ­±»½âÎöµÄÓï¾äÒÔ¼°×îºÃµÄ Ö´Ðз¾¶. Õâ¸ö¹¦ÄÜ´ó´óµØÌá¸ßÁËSQLµÄÖ´ÐÐÐÔÄܲ¢½ÚÊ¡ÁËÄÚ´æµÄʹÓÃ
ËÄ¡¢oracle Óï¾äÌá¸ß²éѯЧÂʵķ½·¨£º
1£º where column in(select * from ... where ...);
2£º... where exists (select 'X' from ...where ...);
µÚ¶þÖÖ¸ñʽҪԶ±ÈµÚÒ»ÖÖ¸ñʽµÄЧÂʸߡ£ÔÚOracleÖпÉÒÔ¼¸ºõ½«ËùÓеÄIN²Ù×÷·û×Ó²éѯ¸ÄдΪʹÓÃEXISTSµÄ×Ó²éѯ ʹÓÃEXIST£¬Oracleϵͳ»áÊ×Ïȼì²éÖ÷²éѯ£¬È»ºóÔËÐÐ×Ó²éѯֱµ½ËüÕÒµ½µÚÒ»¸öÆ¥ÅäÏÕâ¾Í½ÚÊ¡ÁËʱ¼ä OracleϵͳÔÚÖ´ÐÐIN×Ó²éѯʱ£¬Ê×ÏÈÖ´ÐÐ×Ó²éѯ£¬²¢½«»ñµÃµÄ½á¹ûÁбí´æ·ÅÔÚÔÚÒ»¸ö¼ÓÁËË÷ÒýµÄÁÙʱ±íÖÐ ±ÜÃâʹÓÃhaving×Ö¾ä ±ÜÃâʹÓÃHAVING×Ó¾ä, HAVING Ö»»áÔÚ¼ìË÷³öËùÓмǼ֮ºó²Å¶Ô½á¹û¼¯½øÐйýÂË. Õâ¸ö´¦ÀíÐèÒªÅÅÐò,×ܼƵȲÙ×÷. Èç¹ûÄÜͨ¹ýWHERE×Ó¾äÏÞÖƼǼµÄÊýÄ¿,ÄǾÍÄܼõÉÙÕâ·½ÃæµÄ¿ªÏú¡£


Ïà¹ØÎĵµ£º

SQLÖÐtruncate tableºÍdeleteµÄÇø±ð

TRUNCATE TABLE ÔÚ¹¦ÄÜÉÏÓë²»´ø Where ×Ó¾äµÄ Delete
Óï¾äÏàͬ£º¶þÕß¾ùɾ³ý±íÖеÄÈ«²¿ÐС£µ« TRUNCATE TABLE ±È Delete Ëٶȿ죬ÇÒʹÓõÄϵͳºÍÊÂÎñÈÕÖ¾×ÊÔ´ÉÙ¡£
Delete
Óï¾äÿ´Îɾ³ýÒ»ÐУ¬²¢ÔÚÊÂÎñÈÕÖ¾ÖÐΪËùɾ³ýµÄÿÐмǼһÏî¡£TRUNCATE TABLE ͨ¹ýÊÍ·Å´æ´¢±íÊý¾ÝËùÓõÄÊý¾ÝÒ³À´É¾³ýÊý¾Ý£¬²¢ÇÒÖ»ÔÚÊÂÎñÈÕÖ¾ÖмÇÂ¼Ò ......

SQL ѧϰ±Ê¼ÇÖ®SelectÍêÕûÓï·¨¼°Ö´Ðйý³ÌÏê½â

SELECTÓï¾äµÄÍêÕûÓ﷨Ϊ£º
SELECT[ALL|DISTINCT|DISTINCTROW|TOP]
{*|talbe.*|[table.]field1[AS alias1][,[table.]field2[AS alias2][,…]]}
from tableexpression[,…][IN externaldatabase]
[WHERE…]
[GROUP BY…]
[HAVING…]
[ORDER BY…]
[WITH OWNERACCESS OPTION]
×¢ ......

ASP.NET·ÀSQL×¢Èë½Å±¾³ÌÐò

public class SqlCheck  
{  
    public SqlCheck()  
    {  
        //  
        // TODO: ÔÚ´Ë´¦Ìí¼Ó¹¹Ô캯ÊýÂß¼­  
  & ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ