SQL LIKE ͨÅä·û
ͨÅä·û ˵Ã÷
_ ÓëÈÎÒâµ¥×Ö·ûÆ¥Åä
% Óë°üº¬Ò»¸ö»ò¶à¸ö×Ö·ûµÄ×Ö·û´®Æ¥Åä
[ ] ÓëÌض¨·¶Î§£¨ÀýÈ磬[a-f]£©»òÌض¨¼¯£¨ÀýÈ磬[abcdef]£©ÖеÄÈÎÒâµ¥×Ö·ûÆ¥Åä¡£
[^] ÓëÌض¨·¶Î§£¨ÀýÈ磬[^a-f]£©»òÌض¨¼¯£¨ÀýÈ磬[^abcdef]£©Ö®ÍâµÄÈÎÒâµ¥×Ö·ûÆ¥Åä¡£
Àý×Ó:
• WHERE FirstName LIKE '_im' ¿ÉÒÔÕÒµ½ËùÓÐÈý¸ö×ÖĸµÄ¡¢ÒÔ im ½áβµÄÃû×Ö£¨ÀýÈ磬Jim¡¢Tim£©¡£
• WHERE LastName LIKE '%stein' ¿ÉÒÔÕÒµ½ÐÕÒÔ stein ½áβµÄËùÓÐÔ±¹¤¡£
• WHERE LastName LIKE '%stein%' ¿ÉÒÔÕÒµ½ÐÕÖÐÈÎÒâλÖðüÀ¨ stein µÄËùÓÐÔ±¹¤¡£
• WHERE FirstName LIKE '[JT]im' ¿ÉÒÔÕÒµ½Èý¸ö×ÖĸµÄ¡¢ÒÔ im ½áβ²¢ÒÔ J »ò T ¿ªÊ¼µÄÃû×Ö£¨¼´½öÓÐ Jim ºÍ Tim£©
• WHERE LastName LIKE 'm[^c]%' ¿ÉÒÔÕÒµ½ÒÔ m ¿ªÊ¼µÄ¡¢ºóÃæµÄ£¨µÚ¶þ¸ö£©×Öĸ²»Îª c µÄËùÓÐÐÕ¡£
Ïà¹ØÎĵµ£º
1.Ñ¡Ôñ×îÓÐЧÂʵıíÃû˳Ðò(Ö»ÔÚ»ùÓÚ¹æÔòµÄÓÅ»¯Æ÷ÖÐÓÐЧ)¡¡¡¡
¡¡¡¡ SQLSERVERµÄ½âÎöÆ÷°´ÕÕ´ÓÓÒµ½×óµÄ˳Ðò´¦Àífrom×Ó¾äÖеıíÃû£¬Òò´Ëfrom×Ó¾äÖÐдÔÚ×îºóµÄ±í£¨»ù´¡±ídriving table£©½«±»×îÏÈ´¦Àí£¬ÔÚfrom×Ó¾äÖаüº¬¶à¸ö±íµÄÇé¿öÏ£¬±ØÐëÑ¡Ôñ¼Ç¼ÌõÊý×îÉٵıí×÷Ϊ»ù´¡±í£¬µ±SQLSERVER´¦Àí¶à¸ö±íʱ£¬»áÔËÓÃÅÅÐò¼°ºÏ²¢µÄ·½Ê½Á ......
¡¡¡¡SQL»ù±¾Óï¾ä
Ò». SQLµÄËÄÌõ×î»ù±¾µÄÊý¾Ý²Ù×÷Óï¾äΪInsert£¬Select£¬UpdateºÍDelete¡£
¶þ.Ê×ÏÈÎÒÃÇʹÓÃCREATE TABLEÓï¾äÀ´´´½¨Ò»¸ö±í¡£DDLÓï¾ä¶ÔÊý¾Ý¿â¶ÔÏóÈç±í¡¢ÁкÍÊÓ½øÐж¨Òå¡£ËüÃDz¢²»¶Ô±íÖеÄÐнøÐд¦Àí£¬ÕâÊÇÒòΪDDLÓï¾ä²¢²»´¦ÀíÊý¾Ý¿âÖÐʵ¼ÊµÄÊý¾Ý¡£ÕâЩ¹¤×÷ÓÉÁíÒ» ......
Õª×Ôhttp://blog.sina.com.cn/zhm85
SQLÓï¾ä½Øȡʱ¼ä£¬Ö»ÏÔʾÄêÔÂÈÕ£¨2004-09-12£©
select CONVERT(varchar, getdate(), 120 )
‘getdate£¨£©’¸ÄΪʱ¼ä×Ö¶ÎÃû‘createtime’
ÔÙÖØÃüÃûмÓÁУ¨Select Name AS UName from Users£©
ÀýÈç select convert(varchar(11),createtime,120) as Ndate fro ......
. SQL ÃüÁî
Õⲿ·Ö°üº¬ÄÇЩ PostgreSQL Ö§³ÖµÄ SQL ÃüÁîµÄÐÅÏ¢£®ÕâÀïµÄ "SQL" ¾ÍÊǸÃÓïÑÔͨ³£µÄº¬Ò壻 ÿÌõÃüÁîµÄÓë±ê×¼ÓйصļæÈÝÐÔµÄÐÅÏ¢¿ÉÒÔÔÚÏà¹ØµÄ²Î¿¼Ò³ÖÐÕÒµ½£®
Table of Contents
ABORT -- Í˳öµ±Ç°ÊÂÎñ
ALTER GROUP -- Ïò×éÖÐÔö¼ÓÓû§»ò´Ó×éÖÐɾ³ýÓû§
ALTER USER -- ¸Ä±äÊý¾Ý¿â ......
Ò»¡¢ÏÂÔØ°²×°
1¡¢SQL Server 2005 Express Edition
ÏÂÔØ SQL Server 2005 Express Edition£¨ÏÂÔØÒ³Ã棩£º
http://msdn.microsoft.com/vstudio/express/sql/download/
°²×°ÍêÊý¾Ý¿âºóÉèÖÃICP/IPÐÒéÆô¶¯£¨ÕâÒ»²½²»ÄÜÉÙ£¬Ä¬ÈÏÊÇTCP/IP²»ÆôÓõģ©£¬¾ßÌåÈçÏ£º
£¨1£©´ò¿ªSQL Server Configuration Manager
£¨2£©×ªµ½SQL S ......