SQLÓï¾ä¸´Ï°:insert,update,delete,select
×î½üÒ»Ö±ÔÚѧϰSQL serverµÄÄÚÈÝ¡£×òÌ쿼ÁËÒ»ÏÂÊÔ¡£¸Ð¾õÕæµÄÊDz»ÈÝÒ×°¡¡£ÌرðÊÇһЩ¸´ÔӵIJéѯ¡£¸ãµÃÎÒÍ·»èÄÔÕ͵ġ£²»¹ýÒ²ÊÇÓÉÓÚ×Ô¼ºµÄ֪ʶÕÆÎյĻ¹²»¹»Ôúʵ°¡¡£ËùÒÔ½ñÌ츴ϰÁËÒ»ÏÂT-SQlÓï¾äµÄÔöɾ¸Ä²é¡£·¢ÏÖµÄÈ·ÊÇÓкܶ඼Íü¼ÇÁË¡£ÏÖÔڰѽá¹ûд³öÀ´¡£ÒÔºó¿É²»ÒªÍüÁËѽ¡£
--SQLÓï¾ä¸´Ï° --Ò»,²åÈëinsertÓï¾ä --1,insertµ¥ÐÐÊý¾Ý insert into students(sName,sAddress,Ssex,Semail) values('ÐÕÃû','µØÖ·','ÐÔ±ð','ÓʼþµØÖ·')
--2,insert¶àÐÐÊý¾Ý£¬°ÑÆäËû±íÖÐÏÖÓеÄÊý¾Ý¾¹ýÑ¡È¡ºó²åÈëµ½Êý¾Ý¿âÖÐ --°Ñ±íStudent¶ÔÓ¦µÄSname£¬Saddress£¬SemailÈýÁеÄÈ«²¿ÐУ¬ --²åÈëµ½TongXuLu±íÖеÄÐÕÃû£¬µØÖ·£¬µç×ÓÓʼþÈýÁÐÖÐ insert into students(ÐÕÃû,µØÖ·,µç×ÓÓʼþ) select Sname,Saddress,semail from students
--3,insert¶àÐÐÊý¾Ýµ½Ð½¨µÄ±íÖУ¬±í²»ÄÜÊÂÏÈ´æÔÚ --½«´´½¨TongXueLu±í£¬Í¬Ê±´´½¨Èý¸ö×Ö¶ÎSname£¬Saddress£¬Semail£¬ºÍ±êʶÁÐstudentID --²¢ÇÒ°ÑStudent±íÖеÄÕâÈýÁÐÊý¾ÝÏîÈ«²¿²åÈ뵽бíÖС£ select Students.Sname,Students.Saddress,Students.Semail,identity(int,1,1) as studentID--±êʶÁÐÁÐÃû into TongXuLu from Students
--4,ÊÖд¶àÐÐÊý¾Ýͨ¹ýUnionºÏ²¢²åÈë insert students(Sname,Sgrade,Ssex) select 'ÕÅ¿É',7,1 union select 'ÕÅÈý',4,0 union select '³Â¸Õ',4,1 union select 'Íõ¾ê¾ê',7,0
--¶þ£¬updateÊý¾Ý update students set Ssex=1,Sgrade=Sgrade+1 where Ssex=0
--Èý£¬delectÊý¾Ý --1,ɾ³ýÖ¸¶¨Êý¾Ý delete from students where Ssex=0
--2£¬É¾³ýËùÓÐÊý¾Ý --µÚÒ»ÖÖ·½·¨ delete from students --µÚ¶þÖÖ·½·¨,±ÈdeleteÖ´ÐÐËٶȿ죬ʹÓõÄϵͳ×ÊÔ´ºÍÊÂÎñÈÕÖ¾×ÊÔ´¸üÉÙ --µ«ÊDz»ÄÜÓÃÓÚÓÐÍâ¼üÔ¼ÊøµÄ±í truncate table students
--¸½¼Ó --1£¬°ÑËùÓÐÄÐͬѧµÄ³É¼¨¼Ó5·Ö update Sscore set score=score+5 where StudentID(select Scode from students where Ssex=1)
--2£¬Ö»¸´ÖÆStudentsµÄ±í½á¹¹£¬²»¸´ÖÆÊý¾Ý select identity(int 1,1) as InfoID,Sname,Saddress,Sgrade,Semail,Ssex into studnetInfo from students where (1<0)
--ËÄ£¬²éѯ --£¨Ò»£©Ò»°ãÊý¾Ý²éѯ --1£¬²éѯËùÓеÄÊý¾ÝÐкÍÁÐ select * from Students
--2,²éѯ²¿·ÖÊý¾ÝÐÐÁÐ --Ö»²éѯµØַΪ'ºÓÄÏÐÂÏç'µÄѧԱ£¬²¢ÇÒÖ»ÏÔʾ±àºÅ£¬ÐÕÃûºÍµØÖ·ÁÐ select Scode,Sname,Saddress from students where Saddress='ºÓÄÏÐÂÏç'
--3,²éѯÖÐʹÓÃÁÐÃû select scode as ѧÉú±àº
Ïà¹ØÎĵµ£º
ORACLE 10GµÄ¼¯ºÏAPI
¼¯ºÏAPI·½·¨×îÔçÊÇÔÚORACLE 8IÖÐÒýÈëµÄ¡£¼¯ºÏAPIÌṩÁ˼ò»¯·ÃÎʼ¯ºÏµÄ·½·¨¡£ÔÚORACLE 10GÒÔÇ°£¬ÕâЩ·½·¨È·Êµ¼ò»¯Á˶Լ¯ºÏµÄ·ÃÎÊ¡£µ«ÊÇ£¬²¢²»ÊÇ·ÇÒªÇóÕÆÎÕÕâЩ·½·¨²»¿É¡£´ÓORACLE 9IµÄINDEX-BY±íµ½ORACLE 10GµÄÁªºÏÊý×éµÄת»»£¬Ê¹ËüÃdzÉΪ±ØÐëÕÆÎյķ½·¨¡£
ÏÂÃæÊÇÎÒ´ÓÊéÉÏժ¼ÏµÄһР......
window.onerror = function() { return true; };
body {margin:0;overflow:auto;font:normal 14px Verdana;background:#fff;padding:2px 4px 0;}body, p, font, div, li { line-height: 150%;}body, td, th {color:#000000;}.i {width:100%;*width:auto;table-layout:fixed;}pre {white-space: pre-wrap;white-spa ......
×ܽáÒ»ÏÂSQLÓï¾äÖÐÒýºÅ(')¡¢quotedstr()¡¢('')¡¢format()ÔÚSQLÓï¾äÖеÄÓ÷¨ÒÔ¼°SQLÓï¾äÖÐÈÕÆÚ¸ñʽµÄ±íʾ(#)¡¢('')
ÔÚDelphiÖнøÐÐ×Ö·û±äÁ¿Á¬½ÓÏà¼Óʱµ¥ÒýºÅÓÃ('''),ÓÖÒýºÅÓÃ('''')±íʾ
Ê×Ïȶ¨Òå±äÁ¿
var
AnInt:integer=123;//ΪÁË·½±ãÔڴ˶¼¸øËüÃǸ³³õÖµ¡£ËäÈ»¿ÉÄÜÔÚÒý¸³³õÖµÔÚijЩÇé¿öϲ»¶Ô
AnIntStr:string='456'; ......
Êý¾Ý¿âÖÐÖ÷¼üºÍÍâ¼ü
(1)×÷ÓÃ
¼òµ¥ÃèÊö£º
Ö÷¼üÊǶԱíµÄÔ¼Êø£¬±£Ö¤Êý¾ÝµÄΨһÐÔ£¡
Íâ¼üÊǽ¨Á¢±íÓÚ±íÖ®¼äµÄÁªÏµ£¬·½±ã³ÌÐòµÄ±àд£¡
(2)Éè¼ÆÔÔò
Ö÷¼üºÍÍâ¼üÊǰѶà¸ö±í×é֯Ϊһ¸öÓÐЧµÄ¹ØϵÊý¾Ý¿âµÄÕ³ºÏ¼Á¡£Ö÷¼üºÍÍâ¼üµÄÉè¼Æ¶ÔÎïÀíÊý¾Ý¿âµÄÐÔÄܺͿÉÓÃÐÔ¶¼ÓÐמö¶¨ÐÔµÄÓ°Ïì¡£
±ØÐ뽫Êý¾Ý¿âÄ£Ê ......
1¡¢select 1 from mytable;Óëselect anycol(Ä¿µÄ±í¼¯ºÏÖеÄÈÎÒâÒ»ÐУ© from mytable;Óëselect * from mytable ×÷ÓÃÉÏÀ´ËµÊÇûÓвî±ðµÄ£¬¶¼ÊDz鿴ÊÇ·ñÓмǼ£¬Ò»°ãÊÇ×÷Ìõ¼þÓõġ£select 1 from ÖеÄ1ÊÇÒ»³£Á¿£¬²éµ½µÄËùÓÐÐеÄÖµ¶¼ÊÇËü£¬µ«´ÓЧÂÊÉÏÀ´Ëµ£¬1>anycol>*£¬ÒòΪ²»Óòé×Öµä±í¡£
2¡¢²é¿´¼Ç¼ÌõÊý¿ÉÒÔÓÃselect ......