oracleÖаüÀ¨Ä³¸ö×Ö·ûÓÃʲôÌåÏÖ
ʹÓà like ²Ù×÷·û¼ì²é°üÀ¨Ìض¨×Ö·ûµÄ×Ö·û´®£ºlike ²Ù×÷·ûÓï·¨£ºselect ÁÐÃû from ±íÃû where ÁÐÃû like ‘%×Ö·û%’;% ͨÅä·ûÌåÏÖ×Ö·û·ºÆðÔÚ×Ö·û´®ÖеÄÈκÎλÖã»=_ ÔËËã·ûÓÃÓÚ²éÕÒÈ·ÇÐÆ¥ÅäÏnot like ÔËËã·ûÓÃÓÚ²éÕÒ²»°üÀ¨Ìض¨×Ö·ûµÄ×Ö·û´®¡£
Oracle ÖаüÀ¨Ä³¸ö×Ö·ûµÄÌåÏÖ
ÔÚ Oracle ÖУ¬Ê¹Óà LIKE ²Ù×÷·û¼ì²é×Ö·û´®ÊÇ·ñ°üÀ¨Ìض¨×Ö·û¡£LIKE ²Ù×÷·ûµÄÓï·¨ÈçÏ£º
SELECT column_name FROM table_name WHERE column_name LIKE '%character%';
µÇ¼ºó¸´ÖÆ
ÆäÖУº
column_name ÊÇÄúÒª¼ì²éµÄÁÐÃû³Æ¡£
table_name ÊÇÄúÒª´ÓÆä²éÕÒÊý¾ÝµÄ±íÃû³Æ¡£
character ÊÇÄúÒª²éÕÒµÄ×Ö·û¡£
% ÊÇͨÅä·û£¬ÌåÏÖ¸Ã×Ö·û¿ÉÒÔ·ºÆðÔÚ×Ö·û´®ÖеÄÈκÎλÖá£
ʾÀý
¼ÙÉèÄúÓÐÒ»¸öÃûΪ customers µÄ±í£¬ÆäÖаüÀ¨Ò»¸öÃûΪ name µÄÁС£ÄúÒª²éÕÒ°üÀ¨×Öĸ¡°a¡±µÄËùÓпͻ§¡£Äú¿ÉÒÔʹÓÃÒÔÏÂÅÌÎÊ£º
SELECT * FROM customers WHERE name LIKE '%a%';
µÇ¼ºó¸´ÖÆ
´ËÅÌÎʽ«·µ»ØËùÓÐ name ÁÐÖаüÀ¨×Öĸ¡°a¡±µÄ¿Í»§¼Í¼¡£
ÆäËû×¢ÖØÊÂÏî
Òª²éÕÒÈ·ÇÐÆ¥ÅäÏÇëʹÓà =_ ÔËËã·û¡£ÀýÈ磺
SELECT * FROM customers WHERE name = 'John Smith';
µÇ¼ºó¸´ÖÆ
Òª²éÕÒ²»°üÀ¨Ìض¨×Ö·ûµÄ×Ö·û´®£¬ÇëʹÓà NOT LIKE ÔËËã·û¡£ÀýÈ磺
SELECT * FROM customers WHERE name NOT LIKE '%3%';
µÇ¼ºó¸´ÖÆ
ÒÔÉϾÍÊÇoracleÖаüÀ¨Ä³¸ö×Ö·ûÓÃʲôÌåÏÖµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡