sqlÖÐwhereµÄ×÷ÓÃ
where ×Ó¾äÔÚ sql ÖÐÓÃÓÚƾ֤Ìض¨Ìõ¼þ¹ýÂËÐУ¬½öÑ¡ÔñÇкϱê×¼µÄÐС£ËüÌá¸ßÁËÅÌÎÊËÙÂÊ¡¢×¼È·ÐÔºÍÊý¾ÝÍêÕûÐÔ¡£
WHERE ×Ó¾äÔÚ SQL ÖеÄ×÷ÓÃ
WHERE ×Ó¾äÊÇ SQL Óï¾äÖÐÓÃÓÚ¹ýÂËÐв¢½öÑ¡ÔñÖª×ãÌض¨Ìõ¼þµÄÐеÄÒ»¸öÖ÷Òª×é³É²¿·Ö¡£ËüÓÃÓÚÖ¸¶¨Òª¼ìË÷µÄÊý¾ÝµÄÌõ¼þ£¬×ÊÖúÓû§´ÓÊý¾Ý¿âÖÐɸѡ³öËùÐèµÄÐÅÏ¢¡£
×÷Óãº
WHERE ×Ó¾äÔÊÐíÓû§Æ¾Ö¤Ìض¨µÄÌõ¼þ´Ó±íÖÐÑ¡ÔñÌض¨µÄÐС£ËüʹÅÌÎÊÄܹ»½ö¼ìË÷ÇкÏÖ¸¶¨±ê×¼µÄÐУ¬¶ø²»ÊǼìË÷±íÖеÄËùÓÐÐС£
Ó÷¨£º
WHERE ×Ó¾äͨ³£·ºÆðÔÚ SELECT Óï¾äÖУ¬ËüÓÃÓÚÑ¡ÔñÇкÏÖ¸¶¨Ìõ¼þµÄÐС£»ù±¾Óï·¨ÈçÏ£º
SELECT column_list FROM table_name WHERE condition
µÇ¼ºó¸´ÖÆ
Ìõ¼þ£º
Ìõ¼þÊÇ WHERE ×Ó¾äÖÐÓÃÓÚÖ¸¶¨ÒªÉ¸Ñ¡Ðеıê×¼¡£Ëüͨ³£ÓÉÁÐÃû¡¢ÔËËã·ûºÍÖµ×é³É£¬ÀýÈ磺
WHERE column_name = value WHERE column_name > 10 WHERE column_name LIKE 'pattern'
µÇ¼ºó¸´ÖÆ
ʾÀý£º
˼Á¿Ò»ÕÅ°üÀ¨¿Í»§ÐÅÏ¢µÄ±í£¬ÆäÖаüÀ¨ÐÕÃûºÍµØµã¡£Òª½öÑ¡ÔñÆÜÉíÔÚ¡°¼ÓÖÝ¡±µÄ¿Í»§£¬¿ÉÒÔʹÓÃÒÔÏÂÅÌÎÊ£º
SELECT name, address FROM customers WHERE state = 'California'
µÇ¼ºó¸´ÖÆ
ÔÚ´ËʾÀýÖУ¬WHERE ×Ó¾äʹÓÃÌõ¼þ state = ‘California’ À´¹ýÂËÐУ¬½ö¼ìË÷ÆÜÉíÔÚ¼ÓÖݵĿͻ§ÐÅÏ¢¡£
Óŵ㣺
ʹÓà WHERE ×Ó¾äµÄÖ÷ÒªÓŵã°üÀ¨£º
Ìá¸ßÅÌÎÊÐÔÄÜ£ºÍ¨¹ý¹ýÂËÎÞ¹ØÐУ¬¿ÉÒÔÏÔ×ÅÌá¸ßÅÌÎÊËÙÂÊ¡£
׼ȷÐÔ£ºWHERE ×Ó¾äÈ·±£½ö¼ìË÷Öª×ãÖ¸¶¨Ìõ¼þµÄÐУ¬Ìá¸ßÁËÅÌÎÊЧ¹ûµÄ׼ȷÐÔ¡£
Êý¾ÝÍêÕûÐÔ£ºËüÓÐÖúÓÚÈ·±£ÅÌÎʽö¼ìË÷ËùÐèµÄÐÅÏ¢£¬×èֹй¶Ãô¸Ð»òÎÞ¹ØÊý¾Ý¡£
ÒÔÉϾÍÊÇsqlÖÐwhereµÄ×÷ÓõÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡