SQLÖеÄLIKEÓï¾äµÄÓ÷¨
ÔÚSQL½á¹¹»¯²éѯÓïÑÔÖУ¬LIKEÓï¾äÓÐ×ÅÖÁ¹ØÖØÒªµÄ×÷Óá£
¡¡¡¡LIKEÓï¾äµÄÓï·¨¸ñʽÊÇ£ºselect * from ±íÃû where ×Ö¶ÎÃû like ¶ÔÓ¦Öµ£¨×Ó´®£©£¬ËüÖ÷ÒªÊÇÕë¶Ô×Ö·ûÐÍ×ֶεģ¬ËüµÄ×÷ÓÃÊÇÔÚÒ»¸ö×Ö·ûÐÍ×Ö¶ÎÁÐÖмìË÷°üº¬¶ÔÓ¦×Ó´®µÄ¡£
¡¡¡¡¼ÙÉèÓÐÒ»¸öÊý¾Ý¿âÖÐÓиö±ítable1£¬ÔÚtable1ÖÐÓÐÁ½¸ö×ֶΣ¬·Ö±ðÊÇnameºÍsex¶þÕßÈ«ÊÇ×Ö·ûÐÍÊý¾Ý¡£ÏÖÔÚÎÒÃÇÒªÔÚÐÕÃû×Ö¶ÎÖвéѯÒÔ“ÕÅ”×Ö¿ªÍ·µÄ¼Ç¼£¬Óï¾äÈçÏ£º
select * from table1 where name like "ÕÅ*"
Èç¹ûÒª²éѯÒÔ“ÕÅ”½áβµÄ¼Ç¼£¬ÔòÓï¾äÈçÏ£º
¡¡¡¡¡¡select * from table1 where name like "*ÕÅ"
ÕâÀïÓõ½ÁËͨÅä·û“*”£¬¿ÉÒÔ˵£¬likeÓï¾äÊǺÍͨÅä·û·Ö²»¿ªµÄ¡£ÏÂÃæÎÒÃǾÍÏêϸ½éÉÜÒ»ÏÂͨÅä·û¡£
Æ¥ÅäÀàÐÍ¡¡¡¡
ģʽ
¾ÙÀý¡¡¼°¡¡´ú±íÖµ
˵Ã÷
¶à¸ö×Ö·û
*
c*c´ú±ícc,cBc,cbc,cabdfecµÈ
ËüͬÓÚDOSÃüÁîÖеÄͨÅä·û£¬´ú±í¶à¸ö×Ö·û¡£
¶à¸ö×Ö·û
%
%c%´ú±íagdcagdµÈ
ÕâÖÖ·½·¨Ôںܶà³ÌÐòÖÐÒªÓõ½£¬Ö÷ÒªÊDzéѯ°üº¬×Ó´®µÄ¡£
ÌØÊâ×Ö·û
[*]
a[*]a´ú±ía*a
´úÌæ*
µ¥×Ö·û
?
b?b´ú±íbrb,bFbµÈ
ͬÓÚDOSÃüÁîÖеģ¿Í¨Åä·û£¬´ú±íµ¥¸ö×Ö·û
µ¥Êý×Ö
#
k#k´ú±ík1k,k8k,k0k
´óÖÂͬÉÏ£¬²»Í¬µÄÊÇ´úÖ»ÄÜ´ú±íµ¥¸öÊý×Ö¡£
×Ö·û·¶Î§
-
[a-z]´ú±íaµ½zµÄ26¸ö×ÖĸÖÐÈÎÒâÒ»¸ö
Ö¸¶¨Ò»¸ö·¶Î§ÖÐÈÎÒâÒ»¸ö
ÐøÉÏ
Åųý
[!×Ö·û]
[!a-z]´ú±í9,0,%,*µÈ
ËüÖ»´ú±íµ¥¸ö×Ö·û
Êý×ÖÅųý
[!Êý×Ö]
[!0-9]´ú±íA,b,C,dµÈ
ͬÉÏ
×éºÏÀàÐÍ
×Ö·û[·¶Î§ÀàÐÍ]×Ö·û
cc[!a-d]#´ú±íccF#µÈ
¿ÉÒÔºÍÆäËü¼¸ÖÖ·½Ê½×éºÏʹÓÃ
¡¡¡¡¡¡¼ÙÉè±ítable1ÖÐÓÐÒÔϼǼ£º
¡¡¡¡¡¡¡¡¡¡name sex
ÕÅСÃ÷¡¡¡¡¡¡¡¡ÄÐ
¡¡¡¡¡¡¡¡ÀîÃ÷Ìì¡¡¡¡¡¡¡¡¡¡¡¡¡¡ÄÐ
¡¡¡¡¡¡¡¡ÀîaÌì¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Å®
¡¡¡¡¡¡¡¡Íõ5Îå¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ÄÐ
¡¡¡¡¡¡¡¡ÍõÇåÎå¡¡¡¡¡¡¡¡¡¡¡¡ÄÐ
¡¡¡¡ÏÂÃæÎÒÃÇÀ´¾ÙÀý˵Ã÷һϣº
Àý1£¬²éѯname×Ö¶ÎÖаüº¬ÓГÃ÷”×ֵġ£
¡¡¡¡¡¡¡¡¡¡¡¡select * from table1 where name like %Ã÷%
Àý2£¬²éѯname×Ö¶ÎÖÐÒÔ“Àî”×Ö¿ªÍ·¡£
¡¡¡¡¡¡¡¡¡¡¡¡select * from table1 where name like Àî*
Àý3£¬²éѯname×Ö¶ÎÖк¬Ó
Ïà¹ØÎĵµ£º
1¡¢×÷ÓÃ
ɾ³ýÖ¸¶¨³¤¶ÈµÄ×Ö·û£¬²¢ÔÚÖ¸¶¨µÄÆðµã´¦²åÈëÁíÒ»×é×Ö·û¡£
2¡¢Óï·¨
STUFF ( character_expression , start , length ,character_expression )
3¡¢Ê¾Àý
ÒÔÏÂʾÀýÔÚµÚÒ»¸ö×Ö·û´® abcdÖÐɾ³ý´ÓµÚ 2 ¸öλÖã¨×Ö·û b£©¿ªÊ¼µÄÈý¸ö×Ö·û£¬È ......
±¾ÏµÁУ¬»ò¶à»òÉÙ£¬Ö±½Ó»ò¼ä½ÓÒÀÀµÈëÃÅϵÁÐ֪ʶ¡£µ«£¬ÒÀÈ»×·Çó¶ÀÁ¢³ÉÕ¡£Òò±¾ÎÄ×÷ÕßˮƽÓÐÏÞ£¬ÎÄÖдíÎóÄÑÃ⣬¾´Çë¶ÁÕßÖ¸³ö²¢Á½⡣±¾ÏµÁн«»áºÍÈëÃŲ¢´æ¡£
°¸Àý
ij¾ý±»ÑûΪһ³¬ÊÐÉè¼ÆÊý¾Ý¿â£¬ÓÃÀ´´æ´¢Êý¾Ý¡£¸Ã¾ý¸ù¾Ý¸Ã³¬ÊÐÖÐʵ¼Ê³öÏֵĶÔÏó£¬Éè¼ÆÁËCustomer, Employee£¬Order, ProductµÈ±í£¬ÓÃÀ´±£´æÏàÓ¦µÄ¿Í»§£¬Ô±¹¤£¬¶© ......
Mysql°²×°
·µ»ØÖ÷Ŀ¼
MysqlµÄ°²×°Îļþ¿ÉÒÔÖ±½Óµ½ http://www.mysql.com ÏÂÔØ£¬»ñµÃfor win32µÄ.zip°ü£¬½¨ÒéÑ¡Ôñ4.0.20d°æ±¾¡£ÕâÀï²»Ïêϸ˵Ã÷¡£
¡¡¡¡ÏÂÔØ»ñµÃMysqlµÄfor win32°²×°°üºó£¬ÓÃwinzip½âѹËõ£¬Ö±½ÓÔËÐÐsetup.exe£¬ÐèҪעÒâµÄÊÇÑ¡ÔñÒ»¸ö°²×°Â·¾¶£¬µ±È»£¬°²×°Â·¾¶¿ÉÒÔÈÎÒ⣬½¨ÒéÑ¡ÔñC:\MySQLĿ¼¡£°²×°Íê³ÉºóMy ......
ÒÔORACLEÊý¾Ý¿âΪÀý£¬ ½«tab±íÖеÄtname×Ö¶Îת³ÉÒÔ¶ººÅ·Ö¸ôµÄ×Ö·û´®
SQLÈçÏ£º
select substr(max(sys_connect_by_path(tname, ',')), 2)
from (
select b.tname, b.t1, lead(b.t1, 1) over (order by b.t1) t2
from (
select a.tname, row_number() over (orde ......
·µ»Ø´ú±íÖ¸¶¨ÈÕÆÚµÄÖ¸¶¨ÈÕÆÚ²¿·ÖµÄÕûÊý¡£
Óï·¨
DATEPART ( datepart ,date )
²ÎÊý
datepart
ÊÇÖ¸¶¨Ó¦·µ»ØµÄÈÕÆÚ²¿·ÖµÄ²ÎÊý¡£Ï±íÁгöÁË Microsoft® SQL Server™ ʶ±ðµÄÈÕÆÚ²¿·ÖºÍËõд¡£
ÈÕÆÚ²¿·ÖËõд
year
yy, yyyy
quarter
qq, q
month
mm, m
dayofyear
dy, y
day
dd, d
week
wk, ww
weekda ......