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

PL/SQLµ¥Ðк¯ÊýºÍ×麯ÊýÏê½â

 ¡¡¡¡º¯ÊýÊÇÒ»ÖÖÓÐÁã¸ö»ò¶à¸ö²ÎÊý²¢ÇÒÓÐÒ»¸ö·µ»ØÖµµÄ³ÌÐò¡£ÔÚSQLÖÐOracleÄÚ½¨ÁËһϵÁк¯Êý£¬ÕâЩº¯Êý¶¼¿É±»³ÆΪSQL»òPL/SQLÓï¾ä£¬º¯ÊýÖ÷Òª·ÖΪÁ½´óÀࣺ
¡¡¡¡ µ¥Ðк¯Êý
¡¡¡¡ ×麯Êý
¡¡¡¡±¾ÎĽ«ÌÖÂÛÈçºÎÀûÓõ¥Ðк¯ÊýÒÔ¼°Ê¹ÓùæÔò¡£
¡¡¡¡SQLÖеĵ¥Ðк¯Êý
¡¡¡¡SQLºÍPL/SQLÖÐ×Ô´øºÜ¶àÀàÐ͵ĺ¯Êý£¬ÓÐ×Ö·û¡¢Êý×Ö¡¢ÈÕÆÚ¡¢×ª»»¡¢ºÍ»ìºÏÐ͵ȶàÖÖº¯ÊýÓÃÓÚ´¦Àíµ¥ÐÐÊý¾Ý£¬Òò´ËÕâЩ¶¼¿É±»Í³³ÆΪµ¥Ðк¯Êý¡£ÕâЩº¯Êý¾ù¿ÉÓÃÓÚSELECT,WHERE¡¢ORDER BYµÈ×Ó¾äÖУ¬ÀýÈçÏÂÃæµÄÀý×ÓÖоͰüº¬ÁËTO_CHAR,UPPER,SOUNDEXµÈµ¥Ðк¯Êý¡£
SELECT ename,TO_CHAR(hiredate,'day,DD-Mon-YYYY')
from emp
Where UPPER(ename) Like 'AL%'
ORDER BY SOUNDEX(ename)
¡¡¡¡µ¥Ðк¯ÊýÒ²¿ÉÒÔÔÚÆäËûÓï¾äÖÐʹÓã¬ÈçupdateµÄSET×Ӿ䣬INSERTµÄVALUES×Ӿ䣬DELETµÄWHERE×Ó¾ä,ÈÏÖ¤¿¼ÊÔÌرð×¢ÒâÔÚSELECTÓï¾äÖÐʹÓÃÕâЩº¯Êý£¬ËùÒÔÎÒÃǵÄ×¢ÒâÁ¦Ò²¼¯ÖÐÔÚSELECTÓï¾äÖС£
¡¡¡¡NULLºÍµ¥Ðк¯Êý
¡¡¡¡ÔÚÈçºÎÀí½âNULLÉÏ¿ªÊ¼ÊǺÜÀ§Äѵģ¬¾ÍËãÊÇÒ»¸öºÜÓо­ÑéµÄÈËÒÀÈ»¶Ô´Ë¸Ðµ½À§»ó¡£NULLÖµ±íʾһ¸öδ֪Êý¾Ý»òÕßÒ»¸ö¿ÕÖµ£¬ËãÊõ²Ù×÷·ûµÄÈκÎÒ»¸ö²Ù×÷ÊýΪNULLÖµ£¬½á¹û¾ùΪÌá¸öNULLÖµ,Õâ¸ö¹æÔòÒ²ÊʺϺܶຯÊý£¬Ö»ÓÐCONCAT,DECODE,DUMP,NVL,REPLACEÔÚµ÷ÓÃÁËNULL²ÎÊýʱÄܹ»·µ»Ø·ÇNULLÖµ¡£ÔÚÕâЩÖÐNVLº¯Êýʱ×îÖØÒªµÄ£¬ÒòΪËûÄÜÖ±½Ó´¦ÀíNULLÖµ£¬NVLÓÐÁ½¸ö²ÎÊý£ºNVL(x1,x2),x1ºÍx2¶¼Ê½±í´ïʽ£¬µ±x1Ϊnullʱ·µ»ØX2,·ñÔò·µ»Øx1¡£
¡¡¡¡ÏÂÃæÎÒÃÇ¿´¿´empÊý¾Ý±íËü°üº¬ÁËнˮ¡¢½±½ðÁ½ÏÐèÒª¼ÆËã×ܵIJ¹³¥
column name emp_id salary bonus
key type pk
nulls/unique nn,u nn
fk table
datatype number number number
length 11.2 11.2
¡¡¡¡²»ÊǼòµ¥µÄ½«Ð½Ë®ºÍ½±½ð¼ÓÆðÀ´¾Í¿ÉÒÔÁË£¬Èç¹ûijһÐÐÊÇnullÖµÄÇô½á¹û¾Í½«ÊÇnull£¬±ÈÈçÏÂÃæµÄÀý×Ó£º
update emp
set salary=(salary+bonus)*1.1
¡¡¡¡Õâ¸öÓï¾äÖУ¬¹ÍÔ±µÄ¹¤×ʺͽ±½ð¶¼½«¸üÐÂΪһ¸öеÄÖµ£¬µ«ÊÇÈç¹ûûÓн±½ð£¬¼´ salary + null,ÄÇô¾Í»áµÃ³ö´íÎóµÄ½áÂÛ£¬Õâ¸öʱºò¾ÍҪʹÓÃnvlº¯ÊýÀ´ÅųýnullÖµµÄÓ°Ïì¡£
ËùÒÔÕýÈ·µÄÓï¾äÊÇ£º
update emp
set salary=(salary+nvl(bonus,0)*1.1
¡¡¡¡µ¥ÐÐ×Ö·û´®º¯Êý
¡¡¡¡µ¥ÐÐ×Ö·û´®º¯ÊýÓÃÓÚ²Ù×÷×Ö·û´®Êý¾Ý£¬ËûÃÇ´ó¶àÊýÓÐÒ»¸ö»ò¶à¸ö²ÎÊý£¬ÆäÖоø´ó¶àÊý·µ»Ø×Ö·û´®
¡¡¡¡ASCII(<c1>)</c1>
¡¡¡¡c1ÊÇÒ»×Ö·û´®£¬·µ»Øc1µÚÒ»¸ö×ÖĸµÄASCIIÂ룬ËûµÄÄ溯ÊýÊÇCHR()
SELECT ASCII('A') BIG_A,ASCII('z') BIG_z from e


Ïà¹ØÎĵµ£º

sql 2005 ´æ´¢¹ý³Ì·ÖÒ³ java ´úÂë

 create PROCEDURE pagelist
@tablename nvarchar(50),
@fieldname nvarchar(50)='*',         
@pagesize int output,--ÿҳÏÔʾ¼Ç¼ÌõÊý
@currentpage int output,--µÚ¼¸Ò³
@orderid nvarchar(50),--Ö÷¼üÅÅÐò
@sort int,--ÅÅÐò·½Ê½£¬1±íʾÉýÐò£¬0±íʾ½µÐòÅÅÁÐ ......

ÐÔÄܲâÊÔÖ®£º»áÒýÆðÈ«±íɨÃèµÄ¼¸ÖÖSql

1.
      
Ä£ºý²éѯЧÂʺܵͣº
Ô­Òò£º
like
±¾ÉíЧÂʾͱȽϵͣ¬Ó¦¸Ã¾¡Á¿±ÜÃâ²éѯÌõ¼þʹÓÃ
like
£»¶ÔÓÚ
like ‘%...%’
£¨È«Ä£ºý£©ÕâÑùµÄÌõ¼þ£¬ÊÇÎÞ·¨Ê¹ÓÃË÷ÒýµÄ£¬È«±íɨÃè×ÔȻЧÂʺܵͣ»ÁíÍ⣬ÓÉÓÚÆ¥ÅäËã·¨µÄ¹Øϵ£¬Ä£ºý²éѯµÄ×ֶ㤶ÈÔ½´ó£¬Ä£ºý²éѯЧÂÊÔ½µÍ¡£
½â¾ö°ì· ......

µ÷ÓÃSQL´æ´¢¹ý³Ì

±êÇ©£ºÊý¾Ý·ÃÎÊ     ADO.NET
    µ÷ÓÃSQL´æ´¢¹ý³Ì       ´æ´¢¹ý³ÌÔÚÒ»¸öµ¥ÔªÖзâ×°Á˸´ÔÓµÄSQL²éѯºÍÊý¾Ý¹ý³Ì£¬¿ÉÒÔÓɶà¸ö³ÌÐò»òÓû§Ö®¼äµ÷Óá£
    Àý£º
  ......

sql DATEPARTº¯ÊýʹÓÃ

sql DATEPARTº¯ÊýʹÓÃ(Õª³­)
sql DATEPARTº¯ÊýʹÓÃ
DATEPART
·µ»Ø´ú±íÖ¸¶¨ÈÕÆÚµÄÖ¸¶¨ÈÕÆÚ²¿·ÖµÄÕûÊý¡£
Óï·¨
DATEPART ( datepart ,date )
²ÎÊý
datepart
ÊÇÖ¸¶¨Ó¦·µ»ØµÄÈÕÆÚ²¿·ÖµÄ²ÎÊý¡£Ï±íÁгöÁË Microsoft® SQL Server™ ʶ±ðµÄÈÕÆÚ²¿·ÖºÍËõд¡£
ÈÕÆÚ²¿·ÖËõд
year
yy, yyyy
quarter
qq, q
mont ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ