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

sql ´¥·¢Æ÷ʵÀý

¶¨Ò壺ºÎΪ´¥·¢Æ÷£¿ÔÚSQL ServerÀïÃæÒ²¾ÍÊǶÔijһ¸ö±íµÄÒ»¶¨µÄ²Ù×÷£¬´¥·¢Ä³ÖÖÌõ¼þ£¬´Ó¶øÖ´ÐеÄÒ»¶Î³ÌÐò¡£´¥·¢Æ÷ÊÇÒ»¸öÌØÊâµÄ´æ´¢¹ý³Ì¡£
      ³£¼ûµÄ´¥·¢Æ÷ÓÐÈýÖÖ£º·Ö±ðÓ¦ÓÃÓÚInsert , Update , Delete ʼþ¡£
      ÎÒΪʲôҪʹÓô¥·¢Æ÷£¿±ÈÈ磬ÕâôÁ½¸ö±í£º
      Create Table Student(              --ѧÉú±í
        StudentID int primary key,       --ѧºÅ
        ....
       )
      Create Table BorrowRecord(               --ѧÉú½èÊé¼Ç¼±í
        BorrowRecord   int identity(1,1),       --Á÷Ë®ºÅ  
        StudentID      int ,                    --ѧºÅ
        BorrowDate     datetime,                --½è³öʱ¼ä
        ReturnDAte     Datetime,                --¹é»¹Ê±¼ä
        ...
      )
     Óõ½µÄ¹¦ÄÜÓÐ:
        1.Èç¹ûÎÒ¸ü¸ÄÁËѧÉúµÄѧºÅ,ÎÒÏ£ÍûËûµÄ½èÊé¼Ç¼ÈÔÈ»ÓëÕâ¸öѧÉúÏà¹Ø(Ò²¾ÍÊÇͬʱ¸ü¸Ä½èÊé¼Ç¼±íµÄѧºÅ);
        2.Èç¹û¸ÃѧÉúÒѾ­±ÏÒµ£¬ÎÒÏ£Íûɾ³ýËûµÄѧºÅµÄͬʱ£¬Ò²É¾³ýËüµÄ½èÊé¼Ç¼¡£
     µÈµÈ¡£
     Õâʱºò¿ÉÒÔÓõ½´


Ïà¹ØÎĵµ£º

º½¿Õ¹«Ë¾¹ÜÀíϵͳ(VC++ ÓëSQL 2005)

ϵͳ»·¾³£ºWindows 7
Èí¼þ»·¾³£ºVisual C++ 2008 SP1 +SQL Server 2005
±¾´ÎÄ¿µÄ£º±àдһ¸öº½¿Õ¹ÜÀíϵͳ
      ÕâÊÇÊý¾Ý¿â¿Î³ÌÉè¼ÆµÄ³É¹û£¬ËäÈ»³É¼¨²»¼Ñ£¬µ«ÊÇ×÷ΪÎÒÓÃVC++ ÒÔÀ´±àдµÄ×î´ó³ÌÐò»¹ÊÇ´«µ½ÍøÉÏ£¬ÒÔ¹©²Î¿¼¡£ÓÃVC++ ×öÊý¾Ý¿âÉè¼Æ²¢²»ÈÝÒ×£¬µ«Ò²²»ÊDz»¿ÉÄÜ¡£ÒÔÏÂÊÇÎҵijÌÐò½çÃ棬ºóÃæ ......

ÓÃÒ»¸öSQLÓï¾äʵÏÖ²åÈë¶àÐÐÊý¾ÝµÄ¹¦ÄÜ

insert into A ±í select * from B ±í;
ÔÚoracleÖУ¬Ã¿¸öÓû§Ö»ÄܲÙ×÷×Ô¼ºµÄ±í£¬Òª²Ù×÷ÆäËûÓû§µÄ±íÊÇÐèÒªÆäËûÓû§¸³È¨Ï޵ġ£
grant ȨÏÞ on table to user;
   eg:grant select on table to newuser;
ÈôÒª½øÐÐÁ¬½Ó¾ÍÒªÊÚÓè(resource connect Á½¸ö½ÇÉ«) ......

¸ßЧSQL²éѯ֮Ë÷Òý£¨I£©

´óÐÍϵͳµÄÉú²ú»·¾³£¬Ò»°ãÇé¿öÏ£¬ÎÒÃÇÆÀ¼ÛÒ»Ìõ²éѯÊÇ·ñÓÐЧÂÊ£¬¸ü¶àµÄÊǹØ×¢Âß¼­ IO( ÖÁÓÚΪʲô£¬»ØÍ·²¹Ò»Æª ) ¡£ÎÒÃdz£Ëµ£¬“Òª½¨±ëº·µÄË÷Òý”¡¢“Ҫд¸ßЧµÄ SQL ”£¬Æäʵ×îÖÕÄ¿µÄ¾ÍÊÇÔÚÏàͬ½á¹û¼¯Çé¿öÏ£¬¾¡¿ÉÄܼõÉÙÂß¼­ IO ¡£
1.1      where Ìõ¼þµÄÁÐÉ϶¼µÃÓÐͳ¼ÆÐÅÏ¢¡£ ......

Oracle SqlÓÅ»¯±Ê¼Ç(Ò»)


»ù±¾µÄSql±àдעÒâÊÂÏî
¾¡Á¿ÉÙÓÃIN²Ù×÷·û£¬»ù±¾ÉÏËùÓеÄIN²Ù×÷·û¶¼¿ÉÒÔÓÃEXISTS´úÌæ¡£
²»ÓÃNOT IN²Ù×÷·û£¬¿ÉÒÔÓÃNOT EXISTS»òÕßÍâÁ¬½Ó+Ìæ´ú¡£
OracleÔÚÖ´ÐÐIN×Ó²éѯʱ£¬Ê×ÏÈÖ´ÐÐ×Ó²éѯ£¬½«²éѯ½á¹û·ÅÈëÁÙʱ±íÔÙÖ´ÐÐÖ÷²éѯ¡£¶øEXISTÔòÊÇÊ×Ïȼì²éÖ÷²éѯ£¬È»ºóÔËÐÐ×Ó²éѯֱµ½ÕÒµ½µÚÒ»¸öÆ¥ÅäÏî¡£NOT EXISTS±ÈNOT INЧÂÊ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ