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

SQL TRIMµÄÓ÷¨

SQL ÖÐµÄ TRIM º¯ÊýÊÇÓÃÀ´ÒƳýµôÒ»¸ö×Ö´®ÖеÄ×ÖÍ·»ò×Öβ¡£×î³£¼ûµÄÓÃ;ÊÇÒƳý×ÖÊ×»ò×ÖβµÄ¿Õ°×¡£Õâ¸öº¯ÊýÔÚ²»Í¬µÄ×ÊÁÏ¿âÖÐÓв»Í¬µÄÃû³Æ£º
MySQL: TRIM(), RTRIM(), LTRIM()
Oracle: RTRIM(), LTRIM()
SQL Server: RTRIM(), LTRIM()
¸÷ÖÖ trim º¯ÊýµÄÓï·¨ÈçÏ£º
TRIM([[λÖÃ] [ÒªÒƳýµÄ×Ö´®] from ] ×Ö´®): [λÖÃ] µÄ¿ÉÄÜֵΪ LEADING (ÆðÍ·), TRAILING (½áβ), or BOTH (ÆðÍ·¼°½áβ)¡£ Õâ¸öº¯Êý½«°Ñ [ÒªÒƳýµÄ×Ö´®] ´Ó×Ö´®µÄÆðÍ·¡¢½á⣬»òÊÇÆðÍ·¼°½áβÒƳý¡£Èç¹ûÎÒÃÇûÓÐÁгö [ÒªÒƳýµÄ×Ö´®] ÊÇʲôµÄ»°£¬Äǿհ׾ͻᱻÒƳý¡£
LTRIM(×Ö´®): ½«ËùÓÐ×Ö´®ÆðÍ·µÄ¿Õ°×ÒƳý¡£
RTRIM(×Ö´®): ½«ËùÓÐ×Ö´®½áβµÄ¿Õ°×ÒƳý¡£
Àý1:
SELECT TRIM('   Sample   ');
½á¹û:
'Sample'
Àý2:
SELECT LTRIM('   Sample   ');
½á¹û:
'Sample   '
Àý3:
SELECT RTRIM('   Sample   ');
½á¹û:
'   Sample'


Ïà¹ØÎĵµ£º

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ÖÐɾ³ýÖظ´¼Ç¼µÄ¶àÖÖ·½·¨

[Õª]ÔÚSQLÖÐɾ³ýÖظ´¼Ç¼µÄ¶àÖÖ·½·¨
±¾ÎÄ×ܽáÁËһЩɾ³ýÖظ´¼Ç¼µÄ·½·¨£¬ÔÚOracleÖУ¬¿ÉÒÔͨ¹ýΨһrowidʵÏÖɾ³ýÖظ´¼Ç¼£»»¹¿ÉÒÔ½¨ÁÙʱ±íÀ´ÊµÏÖ...ÕâÀïÖ»Ìáµ½ÆäÖеļ¸ÖÖ¼òµ¥ÊµÓõķ½·¨£¬Ï£Íû¿ÉÒԺʹó¼Ò·ÖÏí£¨ÒÔ±íemployeeΪÀý£©¡£
SQL> desc employee
 Name         ......

SQL LIKEµÄÓ÷¨

LIKE ÊÇÁíÒ»¸öÔÚ WHERE ×Ó¾äÖлáÓõ½µÄÖ¸Áî¡£»ù±¾ÉÏ£¬LIKE ÄÜÈÃÎÒÃÇÒÀ¾ÝÒ»¸öÌ×ʽ (pattern) À´ÕÒ³öÎÒÃÇÒªµÄ×ÊÁÏ¡£Ïà¶ÔÀ´Ëµ£¬ÔÚÔËÓà IN µÄʱºò£¬ÎÒÃÇÍêÈ«µØÖªµÀÎÒÃÇÐèÒªµÄÌõ¼þ£»ÔÚÔËÓà BETWEEN µÄʱºò£¬ÎÒÃÇÔòÊÇÁгöÒ»¸ö·¶Î§¡£ LIKE µÄÓï·¨ÈçÏ£º
SELECT "À¸Î»Ãû"
from "±í¸ñÃû"
WHERE "À¸Î»Ãû" LIKE {Ì×ʽ}
{Ì×ʽ} ......

SQL ALIASµÄÓ÷¨

½ÓÏÂÀ´£¬ÎÒÃÇÌÖÂÛ alias (±ðÃû) ÔÚ SQL ÉϵÄÓô¦¡£×î³£Óõ½µÄ±ðÃûÓÐÁ½ÖÖ£º À¸Î»±ðÃû¼°±í¸ñ±ðÃû¡£
¼òµ¥µØÀ´Ëµ£¬À¸Î»±ðÃûµÄÄ¿µÄÊÇΪÁËÈà SQL ²úÉúµÄ½á¹ûÒ׶Á¡£ÔÚ֮ǰµÄÀý×ÓÖУ¬ ÿµ±ÎÒÃÇÓÐÓªÒµ¶î×ܺÏʱ£¬À¸Î»Ãû¶¼ÊÇ SUM(sales)¡£ ËäÈ»ÔÚÕâ¸öÇé¿öÏÂûÓÐʲôÎÊÌ⣬¿ÉÊÇÈç¹ûÕâ¸öÀ¸Î»²»ÊÇÒ»¸ö¼òµ¥µÄ×ܺϣ¬¶øÊÇÒ»¸ö¸´ÔӵļÆË㣬 ......

SQL SUBSTRINGµÄÓ÷¨

SQL ÖÐµÄ substring º¯ÊýÊÇÓÃÀ´×¥³öÒ»¸öÀ¸Î»×ÊÁÏÖеÄÆäÖÐÒ»²¿·Ö¡£Õâ¸öº¯ÊýµÄÃû³ÆÔÚ²»Í¬µÄ×ÊÁÏ¿âÖв»ÍêÈ«Ò»Ñù£º
MySQL: SUBSTR(), SUBSTRING()
Oracle: SUBSTR()
SQL Server: SUBSTRING()
×î³£Óõ½µÄ·½Ê½ÈçÏ (ÔÚÕâÀïÎÒÃÇÓÃSUBSTR()ΪÀý)£º
SUBSTR(str,pos): ÓÉ<str>ÖУ¬Ñ¡³öËùÓдӵÚ<pos>λÖÿªÊ¼µÄ× ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ